javascript - What's the connection between console.log and HTML? -
this question has answer here:
- inserting html div 4 answers
beginner here, might not using correct terms describe this. have loop, else if statement produces result via console.log
.
what want have results (basic fizzbuzz problem) display on html page. have been reading high , low, , getting little discouraged can't figure out on own. guess should .append
don't know if that's right, or event(?) should be. (e.g.; .click, .hover, etc.)
let me know if need more info. head jumbled code i've gone through. appreciated!
here js code:
var choice = prompt("what number should count to?"); (var = 1; <= choice; i++) { if (i % 15 === 0) { console.log('fizzbuzz'); } else if (i % 3 === 0) { console.log('fizz'); } else if (i % 5 === 0) { console.log('buzz'); } else { console.log(i); } }
and html:
<!doctype html> <html> <head> <link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all'> <script src="js/jquery-1.11.1.js"></script> <script src="js/fizzbuzz.js"></script> <title>fizzbuzz!</title> </head> <body> <ol id="log"> </ol> </body> </html>
the tag placeholder of sorts right now...
console.log writes javascript console, ie hit f12 on browser (see image below)
your code appears work, in writes console.
to output in browser window, 1 method use jquery in answer inserting html div
Comments
Post a Comment