Term
What does console.log do? |
|
Definition
Prints the desired string or number to the console |
|
|
Term
Programs may be thought of as being made up of two things: |
|
Definition
1)data 2)operations that manipulate data |
|
|
Term
|
Definition
Outputs the data type of the value that you are checking |
|
|
Term
Data type that must be in “” |
|
Definition
|
|
Term
What happens when you use a comma in a number data type? |
|
Definition
Separates it as two different numbers |
|
|
Term
What two functions can you use to convert a data type? |
|
Definition
|
|
Term
Two ways (3) to declare a variable: |
|
Definition
Let: for changeable ones Const: for immutable ones (Var also works but shouldn’t be used) |
|
|
Term
What happens if you forget to use let or const? |
|
Definition
JavaScript sets it as Var |
|
|
Term
One or more characters that represent a computation (like addition) is called? (+, -, %) |
|
Definition
|
|
Term
Values an operator work on are called? |
|
Definition
|
|
Term
Addition Subtraction Multiplication Division Operators: |
|
Definition
|
|
Term
What is the modulus operator and what does it do? |
|
Definition
% The remainder operator returns the integer remainder of dividing two operands |
|
|
Term
|
Definition
|
|
Term
Increments operator Decrement operator |
|
Definition
|
|
Term
Order of operations: PEDMAS |
|
Definition
Parentheses Exponentiation Multiplication Division Addition Subtraction |
|
|
Term
What does + operator do to strings? |
|
Definition
Pushed them together without spaces |
|
|
Term
Assignment operators Addition Subtraction Multiplication Division |
|
Definition
|
|
Term
How to load in readline -sync to your program: |
|
Definition
Const input= require(‘readline-sync’);
Then
Let info= input.question(“question text”); |
|
|
Term
Never forget ; at the end of your line of code but why? |
|
Definition
That’s how you designate the end of the line |
|
|
Term
JavaScript data type for storing try and false values? |
|
Definition
|
|
Term
Boolean operators: Equal Not equal Greater than Less than Greater/equal Less/equal |
|
Definition
|
|
Term
|
Definition
|
|
Term
Strict equality operator? |
|
Definition
|
|
Term
Boolean expression built out of smaller Boolean expressions is called |
|
Definition
Compound Boolean expression |
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
Boolean operator precedence? |
|
Definition
Not ! Exponentiation ** Multiply/divide */ Add subtract +- Comparison <=,>=,<,> Equality ==,!==,==,!= Logical and/or &&,|| |
|
|
Term
Most basic form of a conditional statement is? |
|
Definition
|
|
Term
|
Definition
If (Boolean condition) {code to execute if Boolean condition is met} |
|
|
Term
How to get even numbers with Boolean if statement: |
|
Definition
If (variable % 2 === 0){} |
|
|
Term
How to get odd number from Boolean if statement: |
|
Definition
If (variable % 2 === 1) {} |
|
|
Term
What do you pair with an if statement to specify code to execute if Boolean condition is false |
|
Definition
|
|
Term
These statements allow us to construct two alternatives paths of an if statement: |
|
Definition
|
|
Term
How to write code with more complex branching behavior by combining conditionals? |
|
Definition
Nesting conditionals: putting an if statement in another if statement. If this is true then check if this is true. |
|
|
Term
Tracking down errors and fixing them in a program is called what? |
|
Definition
|
|
Term
Error types and what they are: |
|
Definition
Syntax-essentially a typo Runtime- error that occurs when the program tries to run Logic- program runs but doesn’t do what is expected |
|
|
Term
More error types: name all 6 from book |
|
Definition
Syntax : missing () or similar Reference:non existing variable is used TypeError using a value in an invalid way RangeError-passing an invalid value to a function URIError improperly using a global URI-handling function Error: type all others are built from |
|
|
Term
What is index of a string or array? |
|
Definition
The position of the specific character (or item in an array) starting from 0-end of data type |
|
|
Term
What is a collection of related data and operations? |
|
Definition
|
|
Term
A piece of data associated with an object? |
|
Definition
|
|
Term
An operation that can be carried out on an object? |
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
|
Definition
Returns the index of a character in a string |
|
|
Term
To make a string all caps or all lower case? |
|
Definition
toLowerCase() toUpperCase() |
|
|
Term
|
Definition
Removes all leading and trailing white space (empty spaces) |
|
|
Term
|
Definition
.replace(example,example)
Returns a copy of the string with the first occurrence of that character replaced by new character |
|
|
Term
|
Definition
.slice(i,j) Returns the substring consisting of characters from index i to j-1 |
|
|
Term
|
Definition
Tab and return for your string |
|
|
Term
|
Definition
(Uses back ticks) (‘${variable} is called on with the ${}’) |
|
|
Term
To declare a string To declare an array |
|
Definition
|
|
Term
A sequence of values that can be accessed via an ordered index. Uses , to separate values |
|
Definition
|
|
Term
Can an array hold strings AND numbers? |
|
Definition
Yes both at the same time too |
|
|
Term
|
Definition
ArrayName.includes(item)
Checks array for specified item |
|
|
Term
|
Definition
Arr.indexOf(item)
Returns the index of the first occurrence of that item. -1 will show if it is not in the array |
|
|
Term
|
Definition
Are.reverse() Reverses the array |
|
|
Term
|
Definition
Are.sort() Alphabetized it into numbers first then cap letters then lower case letters. Does numbers in same way you alphabetize words |
|
|
Term
|
Definition
Are.pop()
Removes and returns the last element of an array |
|
|
Term
|
Definition
Arr.push(item1,item2,...)
Adds one or more items to the end of an array |
|
|
Term
|
Definition
Arr.shift() Removes and returns first element of an array |
|
|
Term
|
Definition
Arr.splice(index,number,item1,item2) Adds removes or replaces one or more elements in an array |
|
|
Term
|
Definition
Arr.unshift(item1,item,2...) Adds one or more items to the start of an array and returns the new length |
|
|
Term
Array methods that create new arrays(4) |
|
Definition
|
|
Term
|
Definition
Arr.concat(array1,array2,...) Combines two or more arrays and returns the new array |
|
|
Term
|
Definition
Arr.join(“connector”) Joins all elements of an array into a string on the connector item |
|
|
Term
|
Definition
Arr.slice(start index, end index) Copies selected entries and puts them into a new array (think copy paste) |
|
|
Term
|
Definition
Arr.split(“delimiter”) Divides string into smaller pieces which are stored into an array. Turns a string into an array |
|
|
Term
How to access items in a multidimensional array (an array of arrays) |
|
Definition
Array[index of first item][index of second item] |
|
|
Term
A repeated execution of a sequence of statements is called? |
|
Definition
|
|
Term
|
Definition
For(let i=0; i < some value; i++) { Code to execute across the array; } |
|
|
Term
Difference between for and while loops? |
|
Definition
For is for definite iteration when we know when it will end While is for when we don’t know how long it will go for |
|
|
Term
|
Definition
For (initial expression; loop condition; update expression) { Loop body } |
|
|
Term
How do you check if your code is doing what you want in the background? |
|
Definition
Use console.log to print and see |
|
|
Term
A loop that will continue as long as it’s Boolean expression remains true? |
|
Definition
|
|
Term
|
Definition
while (Boolean condition) { Code to execute } |
|
|
Term
How to forcibly terminate a loop? |
|
Definition
|
|
Term
How to format a loop break: |
|
Definition
if (condition to be met) { break; } |
|
|
Term
A reusable callable piece of code? |
|
Definition
|
|
Term
The act of using a function by referring to its name? |
|
Definition
Function call Function invocation(invoking a function) |
|
|
Term
Creating a Function format: |
|
Definition
Function functionName(argument1,argument2,....) { Function body } |
|
|
Term
|
Definition
function myFunction (parameters of function separates by ,) { Function body } |
|
|
Term
A function will only execute when? |
|
Definition
|
|
Term
These take inputs and return outputs |
|
Definition
|
|
Term
Proper syntax for return in a function |
|
Definition
return (what will be returned) } Must be inside the Curley brackets |
|
|
Term
NaN What is it and how to use it? |
|
Definition
Not a number isNaN will use Boolean expression of if it is true that it is not a number |
|
|
Term
Is using a return in a function required in all functions? |
|
Definition
No it is optional. But I’d not used it will return nothing out of it. |
|
|
Term
What terminated a function execution? |
|
Definition
return Don’t write anything after it in the function or it won’t work |
|
|
Term
How can you use return more than once in a function? |
|
Definition
|
|
Term
Function parameter vs argument: |
|
Definition
Parameter is what is in the functionName (parameter) when declaring a function Argument is what is put in the parameter () when calling the function for use |
|
|
Term
Good function writing process: 3 steps |
|
Definition
1-design your function: consider what your function will do 2- create a basic structure-use proper format 3- write the body- alternate between sub-tasks and running your code |
|
|
Term
|
Definition
You can’t use a variable that hasn’t been defined yet do this first before using it in a loop/if else statement within the function |
|
|
Term
What is camel case format? |
|
Definition
camelCase lowerStartButEachWordStartsCapNext |
|
|
Term
Things for Good function naming: 3 things |
|
Definition
Use camelCase Use verb/noun pairs ex:fillFuelTank Use descriptive names: ex: convertInchToFeet |
|
|
Term
How many things should a function do? Ultimate goal of function? |
|
Definition
Should do one thing. Even if it takes multiple steps it should accomplish one task |
|
|
Term
How to write an anonymous function variable. Syntax correct |
|
Definition
let variableName = function(parameter1,para2,...) { Body }; |
|
|
Term
Using a function in another function format. Passing a function |
|
Definition
function1Name (function2Name(parameters of function 2)); |
|
|
Term
What the array method map does |
|
Definition
Arr.map(parameters) Runs the function on all items in an array Ex:arr.map(*3) would multiply all items in an array by 3 Creates a new array doesn’t alter the original |
|
|
Term
Process of solving a larger problem by breaking it into smaller pieces that can be solved in the exact same way: |
|
Definition
|
|
Term
Recursion with functions is? |
|
Definition
Using a function in another function so as to keep each function DRY and performing only one task |
|
|
Term
In order to function recursion must fulfill four conditions: |
|
Definition
1-series of small identical steps combine to solve a larger problem 2-base case must be defined 3-recursive function repeatedly calls itself 4-each time the recursive function is called it must alter the data/variables/conditions |
|
|
Term
Each object contains what pairs? |
|
Definition
|
|
Term
|
Definition
Basically a category name And the value is the item in that category. Example: Name: students name |
|
|
Term
Initializing an object: syntax used |
|
Definition
let objectName = { key1:value1 key2:value2 Etc... }; |
|
|
Term
What is a property of an object? |
|
Definition
|
|
Term
How to call a key/value from an object: |
|
Definition
objectName.keyName Or objectName[“keyName”] |
|
|
Term
Should I use . Or [] to call an object key/value? |
|
Definition
[] bc sometimes . Won’t work. Avoid confusion by using [] consistently |
|
|
Term
Modify object properties syntax: |
|
Definition
ObjectName[“keyName”] = newValue; This also works for defining a new key/value pair for an object |
|
|
Term
Can objects use functions? |
|
Definition
Yes it can be the value of a key/value pair |
|
|
Term
Can two identical objects be Boolean true (===) what about a key/value pair within two objects? |
|
Definition
No two objects will always be false value of an object CAN be true if they are identical |
|
|
Term
How do you iterate through an object? |
|
Definition
|
|
Term
|
Definition
for (item*** in objectName) { Code to execute; }
***this is same as i in a for loop it can be called whatever |
|
|
Term
How to use Pi in JavaScript? |
|
Definition
|
|
Term
|
Definition
Math.abs(number) Returns the positive value of number |
|
|
Term
|
Definition
Math.ceil(number) Rounds the decimal number UP to the closest integer value |
|
|
Term
|
Definition
Math.floor(number) Rounds decimal DOWN to closest number (no decimals at all) |
|
|
Term
|
Definition
Math.max(x,y,z....) Returns the largest value from a set of numbers |
|
|
Term
|
Definition
Math.min(x,y,z,....) Returns smallest value from a set of numbers |
|
|
Term
|
Definition
Math.pow(x,y) Gives you the value of X to the power of Y |
|
|
Term
|
Definition
Math.random() returns a random number between 0 and 1 NOT including 1 |
|
|
Term
|
Definition
Math.round(number) Rounds a number to the closest integer value (.5 or higher rounds up .4999999999 or lower rounds down) |
|
|
Term
|
Definition
Math.sqrt(number) Gives the square root of a number |
|
|
Term
|
Definition
Math.trunc(number) Removes any decimals and returns the integer part of number |
|
|
Term
Rounding to decimal places: |
|
Definition
Math.round(number with decimals*100)/100
However many 0s in that (100, 1000, 100,000) is how many decimal places you are rounding two. So 100 gives two decimal places for example. |
|
|
Term
|
Definition
|
|
Term
Syntax to export your module: Just one function |
|
Definition
module.exports = functionName; |
|
|
Term
Syntax to export multiple modules. Remember this must go at the bottom of your code |
|
Definition
module.exports = { function1Name: function1Name function2Name: function2Name Notice this is similar:to objects ... etc } |
|
|
Term
Syntax to import a module: |
|
Definition
Uses apostrophe const jasmine = require(‘../file name.js’); |
|
|
Term
Syntax for loading jasmine for unit testing |
|
Definition
const Jasmine = require(‘jasmine’); const jasmine = new Jasmine(); jasmine.loadConfig({ spec_dir: ‘spec’, spec_files: [ “**/*[sS]pecjs” ], }); jasmine.execute(); |
|
|
Term
Unit testing syntax and format |
|
Definition
describe(“describe function”, function(){ it(“description of test performed”, function(){ expect(functionNameToTest(parameters)).toEqual(“thing to be tested against) Doesn’t have to be toEqual can be whatever is tested |
|
|
Term
Three types of testing to consider: |
|
Definition
Positive: verifies expected behavior with valid data Negative: verifies expected behavior with invalid date Edge case: subset of positive tests which check the extreme edges of valid values (ex 1-100 edge would be 1 and 100) |
|
|