Giter Site home page Giter Site logo

values_types_operators_assignment's Introduction

Pursuit Logo

Values, Types & Operators

Practice reading JS code and understanding what it does!

Learning Objectives

  • Understand different types in javascript
  • Practice reading code & understanding boolean logic
  • Learn the various operators in javascript and what they do

Prerequisites

  • Forking & cloning a repo from git
  • Making a pull request

Getting Started

  1. Fork this repository
  2. Clone the forked repository to your computer
  3. cd to the cloned directory
  4. code . to open the repo in VSCode
  5. When you are done, commit and push your work to your forked copy
  6. Make a pull request on github against the original repo

Instructions

For problems 1 and 2, write your answer in a comment (comments start with //) immediately below the line of code.

Example:

2 + 2
// number, 4

For problems 3-5, fill out the existing table or create a new one. See the table syntax guide

For problems 6-10, see the example in problem 6 and write your own answer below each question.

Problem One

What are the types of the following expressions and what do they evaluate to?

17
//number
1 + 2 * 3 + 4
//number
800 / 80 / 8
//number
400 > 200
//number
1 !== 1
//boolean
true || false
//boolean
true && false
//boolean
20 % 6
//number
"a" + "b"
//string

Problem Two

What will the following return?

typeof 4
4
typeof "hello"
hello
typeof true
true
2 === 1 || 3 === 4
false

Problem Three

Create a truth table for the expression A || B.

For reference, here is a truth table for the expression A && B. You can fill out the last column. Don't worry about keeping the spacing exact.

A B A && B A ll B
true true true true
false true false true
true false false true
false false false false

Problem Four

Create a truth table for the expression !A && !B.

For reference, here is a truth table for the expression A && !B. You can fill out the last column. Don't worry about keeping the spacing exact.

A B !B A && !B !A && !B
true true false false false
false true false false false
true false true true false
false false true false true

Problem Five

Create a truth table for the expression !(A || B). | A | B | !B | A && !B | !(A || B) | | ----- | ----- | ----- | ------- | -------- | | true | true | false | false | false | | false | true | false | false | false | | true | false | true | true | false | | false | false | true | false | true |

Problem Six

Write a step-by-step evaluation for the following expression (remember order of operations): 2 + 3 * 2 + 1. For reference, here is a exp of a step-by-step evaluation:

1 + 2 + 3 + 4
3 + 3 + 4
6 + 4
10
2 + 3 * 2 + 1
2 + 6 + 1
8 + 1
9

Problem Seven

Write a step-by-step evaluation for the following expression (remember order of operations): 4 / 2 + 8 / 4.

4 / 2 + 8 / 4
2 + 8 / 4
2 + 2
4

Problem Eight

Write a step-by-step evaluation for the following expression: 'ca' + 'ter' + 'pi' + 'llar'.

'ca' + 'ter' + 'pi' + 'llar'
'cater' + 'pi' + 'llar'
'caterpi' + 'llar'
caterpillar

Problem Nine

Write a step-by-step evaluation for the following expression: 2 * 4 === 8 && 'car' + 'pool' === 'carpool'.

'2 * 4 === 8 && 'car' + 'pool' === 'carpool''
'8 === 8 && 'car' + 'pool' === 'carpool''
true && 'car' + 'pool' === 'carpool'
true && 'carpool' === 'carpool'
true && true
true

Problem Ten

Write a step-by-step evaluation for the following expression: '1' + '2' + '3' - '1'.

'1' + '2' + '3' - '1'
'12' + '3' - '1'
'123' - '1'
122

values_types_operators_assignment's People

Contributors

coreyladovsky avatar benstone1 avatar alejo4373 avatar bongster91 avatar jabyess avatar xpectro93 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.