Whenever I run my code there is nothing produced in my web browser. Any Suggestions?

+1 Connor O'Shea · November 20, 2015
<!DOCTYPE HTML>

<html>
<head>


</head>

<body>

<script type="text/javascript">
function apples (one, two){
document.write(one + "is better than" + two "<br/>");
}

apples("bucky", "hobart");
apples("bieber", "Jay Z");
apples("apple", "Pear");

</script>

</body>

</html>

Post a Reply

Replies

Oldest  Newest  Rating
0 Scott Walker · November 21, 2015
You're missing the + after the two in your function.

It should be:

document.write(one + " is better than " + two +"");


I've also put a space before and after 'is better than' otherwise it would be one long line of letters :-)
+1 Scott Walker · November 21, 2015

document.write(one + " is better than " + two +" <br/> ");

Made a mistake on the above (forgot the <br>).
0 Johan Andrade · November 21, 2015
Be sure to save the file as a .html extension

And every time you make a change to the code, you have to save and then run.
0 Mark Merry · November 24, 2015
Check with your IT Professor for the course. I heard he is a great prof and earned an A+++++ on ratemyprofessor.com!

Not only that he has phenomenal remarks on Yik Yak!
  • 1

Javascript

107,108 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators