Giter VIP home page Giter VIP logo

fewpjs-reviewing-javascript-events-quiz's Introduction

Quiz: Reviewing JavaScript Events

???

Reviewing JavaScript Events

?: Choose the best definition of scope in JavaScript.

( ) the functions that the browser 'knows about' by default ( ) variables and functions get 'hoisted' to the top ( ) the value of the variables defined inside a function (X) where declared variables and functions are visible

?: Variables declared with ___ are block-scoped:

( ) var (X) let ( ) function

?: Through its scope, a function:

(X) has access to all variables and functions declared in its enclosing scope. ( ) has access to all variables and functions declared only in its inner scope. ( ) has access to variables and functions declared anywhere. ( ) continues to move up the scope chain when it finds a matching identifier in the current scope.

?: In the code example below, what will myVar equal when function2() is run? That is, what will be logged?

const myVar = "Foo";
function function1() {
  const myVar = "Baz";
  console.log(myVar);
}
function function2() {
  const myVar = "Bar";
  function1();
}
function2();

(X) "Baz" ( ) "Foo" ( ) "Bar" ( ) undefined

?: How can a JavaScript event be defined on any DOM node?

(X) addEventListener() ( ) getElementById() ( ) querySelector() ( ) click()

?: Which of these is NOT an example of a JavaScript event?

( ) Submitting a form (X) Calling a javascript function in the global scope ( ) Pressing a key ( ) Scrolling in the browser window

?: Which variable keyword will be hoisted?

( ) let ( ) const ( ) def (X) var

?: Which of the following is NOT true about functions?

( ) functions contain a sequence of JavaScript statements. ( ) functions can be executed multiple times. (X) functions are always executed first. ( ) functions are objects.

?: Choose the version of this function that is the best example of generalization.

(X)

function volunteerTShirtOrder(name = "Unknown", size = "Any") {
  console.log(`${name} ordered a size ${size}`);
}

( )

function volunteerTShirtOrder(name, size) {
  let name = "Octavius";
  let size = "Large";
  console.log(`${name} ordered a size ${size}`);
}

( )

function volunteerTShirtOrder(x, y) {
  console.log(`${x} ordered a size ${y}`);
}

( )

function volunteerTShirtOrder(name, size) {
  let name = "Unknown";
  let size = "Any";
  console.log(`${name} ordered a size ${size}`);
}

?: The DOMContentLoaded event fires when:

( ) the CSS & JavaScript have finished loading. (X) the page's DOM is fully parsed. ( ) the page has begun loading. ( ) there is an error during the page load.

???

fewpjs-reviewing-javascript-events-quiz's People

Contributors

rrcobb avatar drakeltheryuujin 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.