JavaScript Quiz for Beginners
by Kwiz
Qs
21
Difficulty
Junior
Plays
11
Record
1:42
Description

This JavaScript quiz is great for beginners & junior-devs getting ready to start their first job. It covers variable declaration, operators and some peculiarities such as type coercion and strict comparison.

Some of these questions first appeared in the Learn.co Github JavaScript quiz, which can be found here: https://github.com/learn-co-curriculum/js-basics-javascript-basics-quiz

Question Preview
Inside which HTML element do we put a JavaScript program?
Question Preview
What operator can we use to get the opposite value of variable x?
const x = true;
Question Preview
What is the output of the following code?
function helloWorld(x) {
  let x = "Hello";
  console.log(`${x}, world!`);
}

helloWorld("Goodbye");
Question Preview
The following code is a valid function declaration
function x() => {
  console.log("Hello, world!");
}
Question Preview
Which variable type do we use to make sure that the variable cannot be reassigned?
Question Preview
If we declare a variable, let test = 1, then later, reassign with test = 2, what will happen?
Question Preview
If we declare a variable, const test = 1, then later, reassign with test = 2, what will happen?
Question Preview
What are the main differences between let and const?
Question Preview
The != and !== symbols both work the same for inequality comparisons
Question Preview
For strict equality comparisons, we should use
Question Preview
The expression 8 >= 8 evaluates to
Question Preview
The expression 8 > 8 evaluates to
Question Preview
The expression 8 === "8" evaluates to
Question Preview
The expression 8 == "8" evaluates to
Question Preview
What will the return value of the following expression be?
// assume a function
if (5 > 0) {
  return true;
} else {
  return false;
}
Question Preview
What will the return value of the following expression be?
// assume a function
if !(10 > 5) {
  return true;
} else {
  return false;
}
Question Preview
What will the return value of the following expression be?
let str = "hello"
if (!!str) {
  return true;
} else {
  return false;
}
Question Preview
What will the return value of the following expression be?
if (typeof NaN) {
  return true;
} else {
  return false;
}
Question Preview
What will the value of str be after the following expression runs?
let str = "hello"
if (0 > 5) {
  str = "world"
}
Question Preview
What will the value of result be when this code is run and the function, quizFunction, is called with the input of 5?
function quizFunction(argument) {
  return argument
}

const result = quizFunction(5);
Question Preview
What will be the value of result when this code is run and the function, quizFunction, is called with the input of 10?
function quizFunction(argument) {
  return argument/2
}

const result = quizFunction(10);