mkutter72 / js-basics-1-assessment

JavaScript Basics 1 Assessment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

General Assembly Logo

Assessment for JavaScript Fundamentals

You have 30 minutes

Instructions

Fork, clone, branch (response), and npm install.

Follow the prompts below and complete each question. You may use any resource, other than someone else in the classroom, to help you complete this assessment.

You should save your answers in this README.md file, except for your answer to question 5 which should be saved in the file assessment.js.

Question 1

Please list the JavaScript primitives and give one example of each. Boolean - true false Null - one value Null Undefined - Undefined value means a var has not yet been initialized Number - 10, 12 String - "Mike"

Question 2

var c = 5;
var d = 2;
c = c + d;

After this code executes, what is the value of c? Please identify the operators in the last line of this program c = c + d; and explain what they do.

the value of c is 7, the operators are + which adds c and D and = which assigns the result of the addtion to c

Question 3

var x = 4;
var y = 3;
x = y;
y = 10;

After each line of code executes, what are the values of x and y? Do the variables change? Do their values?

line 1: x is first undefined then is set to 4 line 2: y is first undefined then is set to 3 line 3: x is set to 3 line 4: y is set to 10

Question 4

var weather;
weather = "sunny";
weather === "sunny";

What are the values of these expressions? Explain your answers.

line 1: weather is created and set to undefined line 2: weather is set to the string "summy" line 3: the value of weather is compared to the string "summy", true is returned

Question 5

//We'll learn about require later in the course
var ask = require('./ask.js');

var answer = 'not empty';

while (answer !== '' && answer !== 'SeCrEt') {
  answer = ask("Guess my secret? ");
}

Change the code from this question so that it tests for a number betwen 1 and 10 instead of a string. Save it in the file called assessment.js. You can test the code with node assessment.js in your Terminal.


Commit and push your changes.

Submit a pull request.

About

JavaScript Basics 1 Assessment

License:MIT License


Languages

Language:JavaScript 100.0%