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 James Richardson
J
James Richardson
Community Contributor
Quizzes Created: 13 | Total Attempts: 11,392
| Attempts: 112 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1.  What is the correct way to write a JavaScript array?

Explanation

The correct way to write a JavaScript array is by using the syntax var txt = new Array("tim","kim","jim"). This creates an array named "txt" with three elements: "tim", "kim", and "jim".

Submit
Please wait...
About This Quiz
JavaScript Post Course Assessment - Quiz

This 'Javascript Post Course Assessment' evaluates key JavaScript skills, focusing on syntax, functions, operators, and string manipulation. It's designed for learners to demonstrate their understanding and ability to apply JavaScript in practical scenarios.

Personalize your quiz and earn a certificate with your name on it!
2. To display text ''message' along with the value contained in variable msg, an alert box should be called via:

Explanation

To display the text 'message' along with the value contained in the variable msg, the correct way is to call the alert box using the syntax alert ('message' + msg). This will concatenate the string 'message' with the value of the variable msg and display it in an alert box. The other options, such as call alert, alert, and alertBox, are incorrect syntax and will not display the desired result.

Submit
3. Which command skips the rest of a case statement?

Explanation

The correct answer is "break". In a case statement, the break command is used to exit the switch statement and skip the remaining cases. It is often used to prevent fall-through, where execution continues to the next case even after a match is found. By using break, the program will jump to the end of the switch statement, allowing it to continue executing the code after the switch block.

Submit
4. Which event do you use to run something after the page has finished loading?

Explanation

The correct answer is "onload". The "onload" event is used to run something after the page has finished loading. This event is commonly used to trigger functions or scripts that require the page's content to be fully loaded before executing. It ensures that all elements, including images and external resources, have been loaded and are ready to be manipulated or interacted with.

Submit
5.  In a JS statement, what is the difference between a++  vs ++a where a is a variable:

Explanation

The difference between a++ and ++a is that a++ increments the value of a by 1 after the assignment, while ++a increments the value of a by 1 before the assignment.

Submit
6. How do you define a "for" loop which starts from 0, goes till 5 and increments by 1 after each iteration?

Explanation

The correct answer is "for (i = 0; i

Submit
7. Which of these is not a comparison operator?

Explanation

The equal sign (=) is not a comparison operator, but an assignment operator. It is used to assign a value to a variable, rather than comparing two values. Comparison operators are used to compare values and include operators such as greater than (>), less than (=), less than or equal to (

Submit
8. How do you create a function named coolFunction?

Explanation

The correct answer is "function coolFunction () {}". This is the correct way to create a function named coolFunction in JavaScript. The function keyword is used to declare a function, followed by the function name (coolFunction in this case), parentheses for any parameters, and curly braces to enclose the function body.

Submit
9.  How can you reference part of a string starting from 4th character and containing a total of 5 characters contained in var str? (e.g. from a string "hello world!", it should return "lo wo").

Explanation

The correct answer is `str.substr(3,5)` because the `substr()` method in JavaScript is used to extract a portion of a string, starting from the specified index and containing the specified number of characters. In this case, `str.substr(3,5)` will start from the 4th character (index 3) and return a string with 5 characters.

Submit
10. What will the statement mentioned below will do? result =  (testCond == 1) ? "pass" : "fail";

Explanation

The statement mentioned will assign the value "pass" to the variable "result" if the condition "testCond == 1" is true. Otherwise, it will assign the value "fail" to the variable "result".

Submit
View My Results

Quiz Review Timeline (Updated): Feb 23, 2024 +

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

  • Current Version
  • Feb 23, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 01, 2013
    Quiz Created by
    James Richardson
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
 What is the correct way to write a JavaScript array?
To display text ''message' along with the value contained in variable...
Which command skips the rest of a case statement?
Which event do you use to run something after the page has finished...
 In a JS statement, what is the difference between a++  vs...
How do you define a "for" loop which starts from 0, goes...
Which of these is not a comparison operator?
How do you create a function named coolFunction?
 How can you reference part of a string starting from 4th...
What will the statement mentioned below will do?...
Alert!

Advertisement