JS PRIMITIVES & VARIABLES Flashcards
What is the purpose of variables?
A script stores bits on info as data into variables
How do you declare a variable?
You state a variable keyword, name the variable and provide it a value with an assignment operator
How do you initialize (assign a value to) a variable?
Use assignment operator
What characters are allowed in variable names?
Variable names must be unique in a Dataset. Variable names are up to 64 characters long and can only contain letters, digits and nonpunctuation characters (except that a period (.) is allowed. also uses camelCase
_$ can not start with numbers
What does it mean to say that variable names are “case sensitive”?
All variable names must be types with consistent capitaliztion of letters
What is the purpose of a string?
It stores value of letter and other characters, typically used to add text
What is the purpose of a number?
Identifies data for numbers for use in mathmatical operations
What is the purpose of boolean?
It is a data type that identifes true/false values, decision making
What does the = operator mean in JavaScript?
Assignment operator that equals a given value
How do you update the value of a variable?
As JS is cascading a new variable declaration can be made and given a new value
What is the difference between null and undefined?
Null = no value given; undefined = empty;
Why is it a good habit to include “labels” when you log values to the browser console?
It labels what the specific console is doing
Give five examples of JavaScript primitives.
number, string, bollean, null, undefined