Giter Club home page Giter Club logo

week-02's Introduction

Quiz #2

Instructions

  1. Fork this repo
  2. Clone your fork
  3. Fill in your answers by writing in the appropriate area, or placing an 'x' in the square brackets (for multiple-choice questions).
  4. Add/Commit/Push your changes to Github.
  5. Open a pull request.

JavaScript

Question #1

What of the following are JavaScript Data Types?

Select all that apply:

[X] Strings
[X] Booleans
[X] Undefined
[X] NaN
[X] Integers
[X] Arrays
[X] Null

Question #2

Explain what is a REPL, and why is it important for us as developers and help with debugging?

REPL is a live tool used to write code and see the output of your code at the same time.

Question #3

Given the Following Array

var foods = [ ["apple","banana","strawberry"], ["pizza","fries","hamburger"] ];

Create a For Loop that outputs the following string for each piece of fruit in the console. "I want to eat a [fruit]"

for(i = 0; i > 0; i++){
  function() {
    var prompt("I want to eat a" + " " + foods[0])
  }
}

Question #4

Given the Following Array

var foods = [ ["apple","banana","strawberry"], ["pizza","fries","hamburger"] ];

How would I go about accessing the string "pizza" in the above array?

function pizza() {
  console.log([1]);
}

Scope/Context/Closures

Question #5

Describe the rules of scope in JavaScript.

Your Answer:

Scope is the container created to house different areas of your code to ensure the JavaScript behaves the way you want it to.

Question #6

Define an object and store it in a variable pizza. The object should have 2 properties: a temperature (set to 70), and a method called bake. When called, this method should set the pizza's temperature to be 300. Note: you may not use the variable pizza inside your method.

Your Answer:

var pizza = myObject;

var myObject = {
  temperature:
  bake: function () {
    console.log("300 degrees f/c.");

  }
}

Question #7

Define a global variable instructor and set it equal to your Squad Instructor's Name. Then, define the same as a local variable instead.

Your Answer:

var squadLeader = "Matt";

function(squadLeader){
  var squadLeader("Matt");
}

Objects and Functions

Question #8

What are the differences between calling and referencing a function? Please provide examples of each.

If you want to execute the function now the call it. If you want to use it later then you reference it.

Question #9

Using the object literal notation, Define an object called student and give it the properties (your attributes) of name, age, and a method sayHello, that outputs "Hi, my name is [your_name]".

Your Answer:

var student = {
  name: [];
  age: "22";
  sayHello: function() {
    var name = prompt("Enter your name.");
    console.log("Hi, my name is" + " " + name);

  }
console.dir(student);
}

Callbacks

Question #10

What is the difference between synchronous and asynchronous program execution?

Select all that apply:

[X] Synchronous code runs at an even pace, asynchronous code runs with uneven pacing.
[] Synchronous code runs all at the same time, asynchronous code runs completely randomly
[X] Synchronous code runs in order (as appears in the source), asynchronous code may run at a later time.

week-02's People

Contributors

adambray avatar beckybeauchamp1 avatar mattscilipoti avatar mkernsncr avatar robertakarobin 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.