My console.log of Array won't work


#1

var junk = ["D","P",3,4];
console.log(junk)
`

I'm supposed to just print the array "junk"

The error has been: SyntaxError: Unterminated template literal


#2

Works fine for me. Where are you trying to run this piece of code?

BTW you have forgotten the semi-colon after console.log. Try it.


#3

"Make your own array called junk. Put 4 bits of data in it (first 2 strings, then 2 numbers).

Declare it using var.
Put [ ] around your data.
Separate each bit of data with a comma.
End it with a semi-colon.
Use console.log to print out junk."
the instructions


#4

console.log will work with / without semi-colon in browsers. But, in CodeCademy, it may be
necessary. Because they match your code to the expected code.

For example, if you go for jQuery course, you may find lots of errors if you use “ instead of ‘

Try to check rest of the code, you may be missing something in there. This piece of code looks fine to me.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.