Quiz help


Q 1/ var answer = 1+“1”; what the value of variable “answer” why?
Q 2/ var one = 1; Does the following code produce an error if so why?
Q 3/ var 2tress = “tree” Does the following code produce an error if so why?
Q 4/ var ThisIsARealyRealyLongNameForAAvariable = 42; Does the following code produce an error if so why?
Q 5/ var $ =“all the money in the world!”; Does the following code produce an error if so why?

  • A number plus a string.

JavaScript will coerce the number to a string and concatenate.

1 + "1"  =>  "1" + 1  =>  "11"
  • var one = 1;

Is a valid statement with no error.

  • var 2tress = “tree”

JavaScript variables may not begin with a number.

  • var ThisIsARealyRealyLongNameForAAvariable = 42;

No technical error but will give rise to lots of typos and make readability difficult, giving rise to more unintended errors.

  • var $ = “all the money in the world!”;

No error. $ is a valid variable name. It will run into some unexpected problems if a library such as jQuery is installed at load time. $ is the alias for jQuery. If your code suddenly defines it as "all the money in the world* then jQuery will be unloaded.


Thanks for your great help there some few more I just need help every this is ok

Q 1 in three line writes some code that outputs(to the javascript console)all the number from one to 10,000.

Q 2 in the following there is a missing reserved word, indicated [missing word]
is that missing word if ?

[missing word] elementsByName( name) {
//some code
returen (element);

Q 3 same missing word

[missing word] (yourShipHasSailed == true ) {
out OfLuck = true;



What have you attempted so far?


its just quiz Qs thanks for your help


Where are your three lines of code that solve this question?


console.log( 1,2,10000) ?

// <-  1 2 10000

That’s all that will display in the console. Not the solution that is asked for. You need a loop


how I need to write in three line


Do not worry about how many lines, just try to write a solution that works.


need to write this solution // <- 1 2 10000


// <- 1 2 10000

console.log( 1,2,10000)

like this


console.log() takes a comma separated list which will output with spaces instead of commas, just as shown above

1 2 10000

You need to build a loop.


sorry I am new to javascript

console.log( 1 2 10000)


Then it might be best to set the quizzes aside until you get some basics under your belt. Quizzes are not for teaching, but for testing what we know.


Any idea what the above is about?


no idea really I just …


That’s okay. I was just making a point… You haven’t learned about trigonometric identities, it would seem. Would you take a trig quiz to start learning it? Not likely. Same applies here.


console.log( <- 1 2 10000)


Do you have a console open?

In Chrome, type the following into the location bar and enter it…


It will open a blank browser window. Now press, Ctrl + Shift + J to open the JavaScript console.

At the prompt, > enter a JavaScript command and Enter to see the response.


console.log("Hello World!")

The output preceded by <-, which is the symbol I used above, indicates the response. It is not part of the input.

 > console.log("Hello World!")
   Hello World!
<- undefined

undefined is the response when there is no return from the method call. The log method has no return.


Return vs Response

A function has no built in return, but there is no evading a response since a call was made. The processor has no choice but to await a response. Said response not forthcoming when a function has unloaded itself says, undefined.

There is always a response object in play whether or not there is a return value. Keep this distinction clearly in mind at all times and the way forward will be more smooth.

 > tenToTheFourth = []
<- []
 > for (var i = 0; i < 10000; i ++) {
    tenToTheFourth.push(i + 1);

1, 2, 3, …, 9998, 9999, 10000

<- undefined

Give back the memory this uses by clearing the array…

tenToTheFourth = []