ISBN converter working but trouble with input to output
up vote
0
down vote
favorite
After looking at all the suggested threads, which didn't help, so I'm post ing this. I'm new to javascript and I've coded this algo to take a user input that is a string of 10 digits, convert it to an array and then perform a calculation to get a 13 digit ISBN number (I'm a library information technology student)
When I copy and past my code, not all of it shows up and it says I have code that's not formatted as code. This isn't for my homework, I'm going beyond the requirements by trying to do javascript so there's nothing unethical about asking for help I don't think.
I tried posting my code but it says it's not code so if you follow this link you can see a picture of my code.
Thanks for any insight, input comments or demands for clarification or anything.
https://i.postimg.cc/vmx7hB7Q/code.png
javascript arrays input
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
|
show 3 more comments
up vote
0
down vote
favorite
After looking at all the suggested threads, which didn't help, so I'm post ing this. I'm new to javascript and I've coded this algo to take a user input that is a string of 10 digits, convert it to an array and then perform a calculation to get a 13 digit ISBN number (I'm a library information technology student)
When I copy and past my code, not all of it shows up and it says I have code that's not formatted as code. This isn't for my homework, I'm going beyond the requirements by trying to do javascript so there's nothing unethical about asking for help I don't think.
I tried posting my code but it says it's not code so if you follow this link you can see a picture of my code.
Thanks for any insight, input comments or demands for clarification or anything.
https://i.postimg.cc/vmx7hB7Q/code.png
javascript arrays input
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What says it's not formatted as code?
– zfrisch
2 days ago
1
Just paste the code, highlight all of it and Ctrl/Cmd + K (indent all of it by 4 spaces). That should be enough to format it in markdown. If it's too long, just add the relevant snippet.
– Joseph
2 days ago
1
Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
2 days ago
Going through the picture!
– Edwin Dijas Chiwona
2 days ago
I can't see element with id v, your event listener points to undefined function myfunction. So many errors! Try pasting again, I am here to help.
– Edwin Dijas Chiwona
2 days ago
|
show 3 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
After looking at all the suggested threads, which didn't help, so I'm post ing this. I'm new to javascript and I've coded this algo to take a user input that is a string of 10 digits, convert it to an array and then perform a calculation to get a 13 digit ISBN number (I'm a library information technology student)
When I copy and past my code, not all of it shows up and it says I have code that's not formatted as code. This isn't for my homework, I'm going beyond the requirements by trying to do javascript so there's nothing unethical about asking for help I don't think.
I tried posting my code but it says it's not code so if you follow this link you can see a picture of my code.
Thanks for any insight, input comments or demands for clarification or anything.
https://i.postimg.cc/vmx7hB7Q/code.png
javascript arrays input
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
After looking at all the suggested threads, which didn't help, so I'm post ing this. I'm new to javascript and I've coded this algo to take a user input that is a string of 10 digits, convert it to an array and then perform a calculation to get a 13 digit ISBN number (I'm a library information technology student)
When I copy and past my code, not all of it shows up and it says I have code that's not formatted as code. This isn't for my homework, I'm going beyond the requirements by trying to do javascript so there's nothing unethical about asking for help I don't think.
I tried posting my code but it says it's not code so if you follow this link you can see a picture of my code.
Thanks for any insight, input comments or demands for clarification or anything.
https://i.postimg.cc/vmx7hB7Q/code.png
javascript arrays input
javascript arrays input
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited yesterday
A J
4561315
4561315
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 days ago
Ken Richard
12
12
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What says it's not formatted as code?
– zfrisch
2 days ago
1
Just paste the code, highlight all of it and Ctrl/Cmd + K (indent all of it by 4 spaces). That should be enough to format it in markdown. If it's too long, just add the relevant snippet.
– Joseph
2 days ago
1
Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
2 days ago
Going through the picture!
– Edwin Dijas Chiwona
2 days ago
I can't see element with id v, your event listener points to undefined function myfunction. So many errors! Try pasting again, I am here to help.
– Edwin Dijas Chiwona
2 days ago
|
show 3 more comments
What says it's not formatted as code?
– zfrisch
2 days ago
1
Just paste the code, highlight all of it and Ctrl/Cmd + K (indent all of it by 4 spaces). That should be enough to format it in markdown. If it's too long, just add the relevant snippet.
– Joseph
2 days ago
1
Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
2 days ago
Going through the picture!
– Edwin Dijas Chiwona
2 days ago
I can't see element with id v, your event listener points to undefined function myfunction. So many errors! Try pasting again, I am here to help.
– Edwin Dijas Chiwona
2 days ago
What says it's not formatted as code?
– zfrisch
2 days ago
What says it's not formatted as code?
– zfrisch
2 days ago
1
1
Just paste the code, highlight all of it and Ctrl/Cmd + K (indent all of it by 4 spaces). That should be enough to format it in markdown. If it's too long, just add the relevant snippet.
– Joseph
2 days ago
Just paste the code, highlight all of it and Ctrl/Cmd + K (indent all of it by 4 spaces). That should be enough to format it in markdown. If it's too long, just add the relevant snippet.
– Joseph
2 days ago
1
1
Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
2 days ago
Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
2 days ago
Going through the picture!
– Edwin Dijas Chiwona
2 days ago
Going through the picture!
– Edwin Dijas Chiwona
2 days ago
I can't see element with id v, your event listener points to undefined function myfunction. So many errors! Try pasting again, I am here to help.
– Edwin Dijas Chiwona
2 days ago
I can't see element with id v, your event listener points to undefined function myfunction. So many errors! Try pasting again, I am here to help.
– Edwin Dijas Chiwona
2 days ago
|
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
<input type="text" id="input" maxlength="10" size="7">
<button id="input" onclick="myfunction();">Click me</button>
<script type="text/javascript" src="app.js">
var input = "input";
document.getElementById("input").value = input;
function assign(arr, vars) {
var x = {};
var num = math.min(arr.length, vars.length);
for (var i = 0; i < num; ++i) {
x[vars[i]] = arr[i];
}
return x;
}
var arr =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var x = assign(arr, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',]);
var z = (9 + 21 + 8 + (var a*3) + var b + (var c*3) + var d + (var e*3) + var f + (var g*3) + var h + (var i*3) + var j);
var w = (var z % 10);
var v = ("978" + var a, var b, var c, var d, var e, var f, var g, var h, var i, var w);
document.getElementById('v').innerHTML = var v;
</script>
<div id="output"> </div>
</div>
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Honestly, there are so many things wrong here that I'm not sure anyone can help you. Delete this question and post another one where you actually put the code in the question, and explain more carefully and succinctly what you need your algorithm to do (e.g. a sample input and output).
– ecg8
yesterday
Thank you, ecg8, will do after class.
– Ken Richard
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
<input type="text" id="input" maxlength="10" size="7">
<button id="input" onclick="myfunction();">Click me</button>
<script type="text/javascript" src="app.js">
var input = "input";
document.getElementById("input").value = input;
function assign(arr, vars) {
var x = {};
var num = math.min(arr.length, vars.length);
for (var i = 0; i < num; ++i) {
x[vars[i]] = arr[i];
}
return x;
}
var arr =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var x = assign(arr, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',]);
var z = (9 + 21 + 8 + (var a*3) + var b + (var c*3) + var d + (var e*3) + var f + (var g*3) + var h + (var i*3) + var j);
var w = (var z % 10);
var v = ("978" + var a, var b, var c, var d, var e, var f, var g, var h, var i, var w);
document.getElementById('v').innerHTML = var v;
</script>
<div id="output"> </div>
</div>
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Honestly, there are so many things wrong here that I'm not sure anyone can help you. Delete this question and post another one where you actually put the code in the question, and explain more carefully and succinctly what you need your algorithm to do (e.g. a sample input and output).
– ecg8
yesterday
Thank you, ecg8, will do after class.
– Ken Richard
yesterday
add a comment |
up vote
0
down vote
<input type="text" id="input" maxlength="10" size="7">
<button id="input" onclick="myfunction();">Click me</button>
<script type="text/javascript" src="app.js">
var input = "input";
document.getElementById("input").value = input;
function assign(arr, vars) {
var x = {};
var num = math.min(arr.length, vars.length);
for (var i = 0; i < num; ++i) {
x[vars[i]] = arr[i];
}
return x;
}
var arr =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var x = assign(arr, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',]);
var z = (9 + 21 + 8 + (var a*3) + var b + (var c*3) + var d + (var e*3) + var f + (var g*3) + var h + (var i*3) + var j);
var w = (var z % 10);
var v = ("978" + var a, var b, var c, var d, var e, var f, var g, var h, var i, var w);
document.getElementById('v').innerHTML = var v;
</script>
<div id="output"> </div>
</div>
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Honestly, there are so many things wrong here that I'm not sure anyone can help you. Delete this question and post another one where you actually put the code in the question, and explain more carefully and succinctly what you need your algorithm to do (e.g. a sample input and output).
– ecg8
yesterday
Thank you, ecg8, will do after class.
– Ken Richard
yesterday
add a comment |
up vote
0
down vote
up vote
0
down vote
<input type="text" id="input" maxlength="10" size="7">
<button id="input" onclick="myfunction();">Click me</button>
<script type="text/javascript" src="app.js">
var input = "input";
document.getElementById("input").value = input;
function assign(arr, vars) {
var x = {};
var num = math.min(arr.length, vars.length);
for (var i = 0; i < num; ++i) {
x[vars[i]] = arr[i];
}
return x;
}
var arr =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var x = assign(arr, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',]);
var z = (9 + 21 + 8 + (var a*3) + var b + (var c*3) + var d + (var e*3) + var f + (var g*3) + var h + (var i*3) + var j);
var w = (var z % 10);
var v = ("978" + var a, var b, var c, var d, var e, var f, var g, var h, var i, var w);
document.getElementById('v').innerHTML = var v;
</script>
<div id="output"> </div>
</div>
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
<input type="text" id="input" maxlength="10" size="7">
<button id="input" onclick="myfunction();">Click me</button>
<script type="text/javascript" src="app.js">
var input = "input";
document.getElementById("input").value = input;
function assign(arr, vars) {
var x = {};
var num = math.min(arr.length, vars.length);
for (var i = 0; i < num; ++i) {
x[vars[i]] = arr[i];
}
return x;
}
var arr =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var x = assign(arr, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',]);
var z = (9 + 21 + 8 + (var a*3) + var b + (var c*3) + var d + (var e*3) + var f + (var g*3) + var h + (var i*3) + var j);
var w = (var z % 10);
var v = ("978" + var a, var b, var c, var d, var e, var f, var g, var h, var i, var w);
document.getElementById('v').innerHTML = var v;
</script>
<div id="output"> </div>
</div>
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 2 days ago
Ken Richard
12
12
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Ken Richard is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Honestly, there are so many things wrong here that I'm not sure anyone can help you. Delete this question and post another one where you actually put the code in the question, and explain more carefully and succinctly what you need your algorithm to do (e.g. a sample input and output).
– ecg8
yesterday
Thank you, ecg8, will do after class.
– Ken Richard
yesterday
add a comment |
1
Honestly, there are so many things wrong here that I'm not sure anyone can help you. Delete this question and post another one where you actually put the code in the question, and explain more carefully and succinctly what you need your algorithm to do (e.g. a sample input and output).
– ecg8
yesterday
Thank you, ecg8, will do after class.
– Ken Richard
yesterday
1
1
Honestly, there are so many things wrong here that I'm not sure anyone can help you. Delete this question and post another one where you actually put the code in the question, and explain more carefully and succinctly what you need your algorithm to do (e.g. a sample input and output).
– ecg8
yesterday
Honestly, there are so many things wrong here that I'm not sure anyone can help you. Delete this question and post another one where you actually put the code in the question, and explain more carefully and succinctly what you need your algorithm to do (e.g. a sample input and output).
– ecg8
yesterday
Thank you, ecg8, will do after class.
– Ken Richard
yesterday
Thank you, ecg8, will do after class.
– Ken Richard
yesterday
add a comment |
Ken Richard is a new contributor. Be nice, and check out our Code of Conduct.
Ken Richard is a new contributor. Be nice, and check out our Code of Conduct.
Ken Richard is a new contributor. Be nice, and check out our Code of Conduct.
Ken Richard is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53402487%2fisbn-converter-working-but-trouble-with-input-to-output%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What says it's not formatted as code?
– zfrisch
2 days ago
1
Just paste the code, highlight all of it and Ctrl/Cmd + K (indent all of it by 4 spaces). That should be enough to format it in markdown. If it's too long, just add the relevant snippet.
– Joseph
2 days ago
1
Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
2 days ago
Going through the picture!
– Edwin Dijas Chiwona
2 days ago
I can't see element with id v, your event listener points to undefined function myfunction. So many errors! Try pasting again, I am here to help.
– Edwin Dijas Chiwona
2 days ago