GithubHelp home page GithubHelp logo

js-basics-javascript-basics-quiz-nyc-web-060319's Introduction

JavaScript Basics Quiz

???

JavaScript Basics Quiz

?: If we declare a variable, let test = 1, then later, reassign, stating test = 2, what will happen?

(X) test will equal 2 ( ) test will equal 1 ( ) JavaScript will raise a TypeError ( ) test will equal undefined

?: If we declare a variable, const test = 1, then later, reassign, stating test = 2, what will happen?

( ) test will equal 2 ( ) test will equal 1 (X) JavaScript will raise a TypeError ( ) test will equal undefined

?: If we declare a variable, let test = 1, then later, reassign, stating var test = 2, what will happen if both are in the same scope?

( ) both variables will be declared (X) JavaScript will raise a SyntaxError ( ) var test will reassign let test ( ) var test will be ignored as test is already declared

?: If we declare a variable, var test = 1, then later, reassign, stating var test = 2, what will happen?

( ) both variables will be declared ( ) JavaScript will raise a SyntaxError (X) var test = 2 will reassign var test = 1 ( ) var test will be ignored as test is already declared

?: What are the main differences between let and const?

(X) let can be reassigned, const cannot be reassigned ( ) let cannot be reassigned, const can be reassigned ( ) let is functional scope, while const is block scope ( ) let is block scope, while const is functional scope

?: The != and !== symbols both work the same for inequality comparisons:

( ) True (X) False

?: For strict equality comparisons, we should use:

( ) = ( ) == (X) ===

?: The expression 8 >= 8 evaluates to:

(X) True ( ) False

?: The expression 8 > 8 evaluates to:

( ) True (X) False

?: The expression 8 === "8" evaluates to:

( ) True (X) False

?: The expression 8 == "8" evaluates to:

(X) True ( ) False

?: What will the return value of the following expression be?

if (5 > 0) {
  return true;
} else {
  return false;
}

(X) true ( ) false

?: What will the return value of the following expression be?

if !(10 > 5) {
  return true;
} else {
  return false;
}

( ) true (X) false

?: What will the return value of the following expression be?

let str = "hello"
if (!!str) {
  return true;
} else {
  return false;
}

(X) true ( ) false

?: What will the return value of the following expression be?

if (NaN) {
  return true;
} else {
  return false;
}

( ) true (X) false

?: What will the return value of the following expression be?

if (typeof NaN) {
  return true;
} else {
  return false;
}

(X) true ( ) false

?: What will the value of str be after the following expression runs?

let str = "hello"
if (0 > 5) {
  str = "world"
}

(X) "hello" ( ) "world" ( ) undefined ( ) null

?: What will be the value of result 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);

( ) argument ( ) "5" ( ) "argument" (X) 5

?: 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);

( ) argument/2 (X) 5 ( ) "argument/2" ( ) 10/2

?: 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) {
  if (argument < 5) {
    return true
  }
  return false
}

const result = quizFunction(10);

( ) argument < 5 ( ) true ( ) 10 (X) false

?: What will be the value of result when this code is run and called with the input of 5?

function triple(argument) {
  return argument * 3
}

function minusTwo(argument) {
  return argument - 2
}

const result = triple(minusTwo(5));

(X) 9 ( ) 13 ( ) TypeError ( ) undefined

?: What about if we flipped the order of the same functions?

function triple(argument) {
  return argument * 3
}

function minusTwo(argument) {
  return argument - 2
}

minusTwo(triple(5));

( ) 9 (X) 13 ( ) TypeError ( ) undefined

???

View JavaScript Basics Quiz on Learn.co and start learning to code for free.

js-basics-javascript-basics-quiz-nyc-web-060319's People

Contributors

gj avatar maxwellbenton avatar peterbell avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.