Help me with Javascript

Help me with Javascript


I’m learning Javascript these days,using The book called Dom programming art
Here is the problem,I want to use JS to create content,but nothing happen when I open my html document. What’s the problem? Thank you
Here is the code below:

	var para=document.creatElement("p");
	var txt=document.creatTextNode("hello world");
	var testdiv=document.getElementById("testdiv");
<!DOCTYPE html>
<html lang="en">
  <meta charset="utf-8"/>
 <div id="testdiv">
  <script type="text/javascript" src="scripts/example.js"></script>


you have a typo in your code. its var para= document.createElement(“p”) not var para=document.creatElement(“p”);

You missed an “e” in document.creatElemen


Hello there I started learning javascript. I still cant figure a way to get past this challenge. If anyone can help that will be great. The question below:

You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.

We have provided a framework for testing your results with different words. The tests will run your function with several different inputs to make sure all of the provided words appear in the output, as well as your extra strings.

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = “”;
// Your code below this line
result = “myNoun” + “myAdjective” + “myVerb” + “myAdverb”;

// Your code above this line
return result;

// Change the words here to test your function
wordBlanks(“dog”, “big”, “ran”, “quickly”);


did u try without quotes? like:
result = myNoun + myAdjective + myVerb + myAdverb;
since myNoun and others are VARIABLES
if u put something in quotes programs treat it like strings (text) so your output would be:
and not:

if u want to separate them it should go like:
result = myNoun + " " + myAdjective + " " + myVerb + " " + myAdverb;


Thank you so much pal, you’re a life saver.


I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

You can’t post raw html, since it does not display.