JavaScript Flashcards
scripts
programs that accompany web pages.
Run in web browsers and make web pages more dynamic and powerful
variables
should start with lower case letter
displays in browser console
console.log()
displays on the web page
document.write()
mark the end of a statement
semicolon
optional unless we write multiple statements in a single line
comments
// single line /*multi line*/
open the console
Ctrl + Shift + J
javascript
programming language of the web
create a variable
var name/identifier = value;
undefined
a value
maximum number of decimal places JavaScript can handle
17
to know what type of data a variable contains
console.log(typeof(variable’s name));
data types
string
numbers
Boolean
object
special kind of comparison operator that requires the value and the type to be equal
===
logical and
logical or
&&
||
assign a value to a variable based on a condition being true or false
conditional operator
?
if non-boolean values have real value except 0, “”, undefined
when converted condition returns true
perform different actions based on different condition
conditional statements
if, switch
concatenate strings
string.concat(string);
to find how many characters a string have
string.length;
escaping character
\
extract a piece of string
slice(start, end);
substr(start, length);
replace
string.replace(search string, replace string);
change a string to use lower/upper case letters
string. toLowerCase();
string. toUpperCase():