NYC Codecademy Group - JavaScript Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Ronantopolski
R
Ronantopolski
Community Contributor
Quizzes Created: 1 | Total Attempts: 353
| Attempts: 353 | Questions: 17
Please wait...
Question 1 / 17
0 %
0/100
Score 0/100
1. Var numbers = [1, 2, 3] is an example of:

Explanation

An array is a special variable which can hold more than one value at a time.
See Codecademy lesson

Submit
Please wait...
About This Quiz
JavaScript Quizzes & Trivia

This quiz will test your knowledge of JavaScript.

Good Luck!
-Ron

2. If (name.length > 0) { console.log("Please enter your name."); } else { console.log("Hello " + name); } is an example of:

Explanation

If the condition (name.length>0) is true, statement1 will be executed. Otherwise, statement2 will be executed.

See Codecademy lesson

Submit
3. Switch (GPA){ case 90: letterGrade = "A+"; break; case 80: letterGrade = "A"; break; case 70: letterGrade = "C"; break; case 60: letterGrade = "D"; break; case 50: letterGrade = "E"; break; default: letterGrade = "F"; break; }

Explanation

Switch statements are a shorthand way to write if else statements when there are many different cases, and each case has a different outcome.

See Codecademy lesson

Submit
4. I++

Explanation

Incrementors/Decrementors are used to increase/reduce the value of a variable by 1
See Codecademy lesson

Submit
5. Var i; for (i = 0; i < 2; i++) {   console.log("i is now equal to " + i);

Explanation

In JavaScript, there are two different kind of loops:
for - loops through a block of code a specified number of times
while - loops through a block of code while a specified condition is true
See Codecademy lesson

Submit
6. Var i = 0; while ( i < 2 ) {   console.log( "i is now " + i );   i++; }

Explanation

In JavaScript, there are two different kind of loops:



for - loops through a block of code a specified number of times

while - loops through a block of code while a specified condition is true



See Codecademy lesson

Submit
7. In the function below, what does the text '(w, l)' represent? var area = function (w, l) {   return w * l; };

Explanation

A parameter is a variable that is processed by the function to generate a given result. In this case, if we run the function as follows: area(2,3); we will get a result of 6. To further clarify, parameters are the variables in the declaration of a function (w,l) while arguments are the specific values that get passed when running the function (2,3)



See Codecademy lesson

Submit
8. Var = myName is an example of a

Explanation

variables are used to hold values or expressions



See Codecademy lesson

Submit
9. Is an example of a:

Explanation

A function contains code that will be executed by an event or by a call to the function. In this case, we would call the function by writing a command: hello(); which would display the text "i am saying hello" in the console.



See Codecademy lesson

Submit
10. Is an example of a

Explanation

A function contains code that will be executed by an event or by a call to the function.



See Codecademy lesson:

Submit
11. Var dogName = dog.name

is an example of accessing an object's property using:

Explanation

When you access a property, you are setting a variable equal to the the value of a property in a particular object.



In this example, we are setting variable dogName equal to the value of the 'name' property of the 'dog' object.



See Codecademy lesson

Submit
12. For the object below, what does the word 'name' represent?

var dog = {name: "Daisy", age: 6};

Explanation

In this object, 'name' is a property. A property is a type of information that describes the object and is always paired with a value.

Objects can written in two different ways, depending on how the properties are defined within them:



1. Object Literal Notation:



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mo»{«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»:«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»Daisy«/mi»«mo»§quot;«/mo»«mo»,«/mo»«mi mathvariant=¨normal¨»age«/mi»«mo»:«/mo»«mn»6«/mn»«mo»)«/mo»«mo»;«/mo»«/math»

2. Object Constructor Notation



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mo»(«/mo»«mo»)«/mo»«mo»;«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»=«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»Daisy«/mi»«mo»§quot;«/mo»«mo»;«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»age«/mi»«mo»=«/mo»«mn»6«/mn»«mo»;«/mo»«/math»



In addition to representing properties in two different ways when creating an object, you can also access properties two different ways:



1. Dot Notation



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dogName«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»name«/mi»«/math»

2. Bracket Notation:



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dogName«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»[«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»§quot;«/mo»«mo»]«/mo»«/math»



See Codecademy lesson

Submit
13. Is an example of accessing an object's property using:

Explanation

When you access a property, you are setting a variable equal to the the value of a property in a particular object.



In this example, we are setting variable dogName equal to the value of the 'name' property of the 'dog' object.



See Codecademy lesson

Submit
14. Select which of the options below are data types

Explanation

The three data types are number, string and Boolean.



See Codecademy lesson

Submit
15. Is an example of

Explanation

Ternary operators are a shorthand way of writing if else statements.

See Codecademy lesson

Submit
16. Is an example of creating an object using:

Explanation

Objects can written in two different ways, depending on how the properties are defined within them:



1. Object Literal Notation:



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mo»{«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»:«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»Daisy«/mi»«mo»§quot;«/mo»«mo»,«/mo»«mi mathvariant=¨normal¨»age«/mi»«mo»:«/mo»«mn»6«/mn»«mo»)«/mo»«mo»;«/mo»«/math»

2. Object Constructor Notation



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mo»(«/mo»«mo»)«/mo»«mo»;«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»=«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»Daisy«/mi»«mo»§quot;«/mo»«mo»;«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»age«/mi»«mo»=«/mo»«mn»6«/mn»«mo»;«/mo»«/math»



In addition to representing properties in two different ways when creating an object, you can also access properties two different ways:



1. Dot Notation



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dogName«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»name«/mi»«/math»

2. Bracket Notation:



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dogName«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»[«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»§quot;«/mo»«mo»]«/mo»«/math»



See Codecademy lesson

Submit
17. Var dog = (); dog.name = "Daisy"; dog.age = 6;

is an example of creating an object using:

Explanation

Objects can written in two different ways, depending on how the properties are defined within them:



1. Object Literal Notation:



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mo»{«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»:«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»Daisy«/mi»«mo»§quot;«/mo»«mo»,«/mo»«mi mathvariant=¨normal¨»age«/mi»«mo»:«/mo»«mn»6«/mn»«mo»)«/mo»«mo»;«/mo»«/math»

2. Object Constructor Notation



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mo»(«/mo»«mo»)«/mo»«mo»;«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»=«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»Daisy«/mi»«mo»§quot;«/mo»«mo»;«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»age«/mi»«mo»=«/mo»«mn»6«/mn»«mo»;«/mo»«/math»



In addition to representing properties in two different ways when creating an object, you can also access properties two different ways:



1. Dot Notation



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dogName«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo».«/mo»«mi mathvariant=¨normal¨»name«/mi»«/math»

2. Bracket Notation:



«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mi mathvariant=¨normal¨»var«/mi»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dogName«/mi»«mo»§nbsp;«/mo»«mo»=«/mo»«mo»§nbsp;«/mo»«mi mathvariant=¨normal¨»dog«/mi»«mo»[«/mo»«mo»§quot;«/mo»«mi mathvariant=¨normal¨»name«/mi»«mo»§quot;«/mo»«mo»]«/mo»«/math»



See Codecademy lesson

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 02, 2012
    Quiz Created by
    Ronantopolski
Cancel
  • All
    All (17)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Var numbers = [1, 2, 3] is an example of:
If (name.length > 0) {...
Switch (GPA){...
I++
Var i;...
Var i = 0;...
In the function below, what does the text '(w, l)' represent?...
Var = myName is an example of a
Is an example of a:
Is an example of a
Var dogName = dog.name...
For the object below, what does the word 'name' represent?...
Is an example of accessing an object's property using:
Select which of the options below are data types
Is an example of
Is an example of creating an object using:
Var dog = (); dog.name = "Daisy"; dog.age = 6;...
Alert!

Advertisement