ISBN converter working but trouble with input to output












0














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
























  • What says it's not formatted as code?
    – zfrisch
    Nov 20 at 22:26






  • 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
    Nov 20 at 22:27








  • 1




    Copy the critical part of the code and click the {} button. Try again please
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • Going through the picture!
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • 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
    Nov 20 at 22:33
















0














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
























  • What says it's not formatted as code?
    – zfrisch
    Nov 20 at 22:26






  • 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
    Nov 20 at 22:27








  • 1




    Copy the critical part of the code and click the {} button. Try again please
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • Going through the picture!
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • 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
    Nov 20 at 22:33














0












0








0







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















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















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 5:20









A J

5341319




5341319










asked Nov 20 at 22:22









Ken Richard

12




12












  • What says it's not formatted as code?
    – zfrisch
    Nov 20 at 22:26






  • 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
    Nov 20 at 22:27








  • 1




    Copy the critical part of the code and click the {} button. Try again please
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • Going through the picture!
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • 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
    Nov 20 at 22:33


















  • What says it's not formatted as code?
    – zfrisch
    Nov 20 at 22:26






  • 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
    Nov 20 at 22:27








  • 1




    Copy the critical part of the code and click the {} button. Try again please
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • Going through the picture!
    – Edwin Dijas Chiwona
    Nov 20 at 22:28










  • 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
    Nov 20 at 22:33
















What says it's not formatted as code?
– zfrisch
Nov 20 at 22:26




What says it's not formatted as code?
– zfrisch
Nov 20 at 22:26




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
Nov 20 at 22:27






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
Nov 20 at 22:27






1




1




Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
Nov 20 at 22:28




Copy the critical part of the code and click the {} button. Try again please
– Edwin Dijas Chiwona
Nov 20 at 22:28












Going through the picture!
– Edwin Dijas Chiwona
Nov 20 at 22:28




Going through the picture!
– Edwin Dijas Chiwona
Nov 20 at 22:28












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
Nov 20 at 22:33




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
Nov 20 at 22:33












1 Answer
1






active

oldest

votes


















0














<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

















  • 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
    Nov 21 at 6:26










  • Thank you, ecg8, will do after class.
    – Ken Richard
    Nov 21 at 16:28











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',
autoActivateHeartbeat: false,
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
});


}
});














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









0














<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

















  • 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
    Nov 21 at 6:26










  • Thank you, ecg8, will do after class.
    – Ken Richard
    Nov 21 at 16:28
















0














<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

















  • 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
    Nov 21 at 6:26










  • Thank you, ecg8, will do after class.
    – Ken Richard
    Nov 21 at 16:28














0












0








0






<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












<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












share|improve this answer



share|improve this answer










answered Nov 21 at 0:22









Ken Richard

12




12








  • 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
    Nov 21 at 6:26










  • Thank you, ecg8, will do after class.
    – Ken Richard
    Nov 21 at 16:28














  • 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
    Nov 21 at 6:26










  • Thank you, ecg8, will do after class.
    – Ken Richard
    Nov 21 at 16:28








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
Nov 21 at 6:26




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
Nov 21 at 6:26












Thank you, ecg8, will do after class.
– Ken Richard
Nov 21 at 16:28




Thank you, ecg8, will do after class.
– Ken Richard
Nov 21 at 16:28


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




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

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen