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










share|improve this question









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















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










share|improve this question









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













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










share|improve this question









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






share|improve this question









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.











share|improve this question









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.









share|improve this question




share|improve this question








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


















  • 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












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>





share|improve this answer








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











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Ken Richard is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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

























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>





share|improve this answer








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















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>





share|improve this answer








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













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>





share|improve this answer








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>






share|improve this answer








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.









share|improve this answer



share|improve this answer






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














  • 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










Ken Richard is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















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.















 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Sphinx de Gizeh

Dijon

Équipe cycliste