Javascript Flashcards
<p>+</p>
<p>Returns the sum or 2 numbers or concatenates 2 strings</p>
<p>%</p>
<p>Modulo Returns the remainder of the first value divided by the second</p>
Javascript Primitive Data Types(5)
String, Number, Boolean, Null, Undefined
<p>2 + "2"</p>
<p>Concatenation = 22</p>
10 > 2
returns true
typeof()
tells us what the type is typeOf(10<2) returns boolean
Javascript Null
A value does not exist
Javascript Undefined
The variable has yet to be defined
Javascript prompt
Creates and alert box that accepts an input; var x = prompt(“what is x”);
Random number between 0 and 5
var _randNum = Math.round(Math.random() * 5);
Check if number is divisible by 3
if (x%3 === 0)
Property
Values of an object Dog.breed breed is property; noun
Method
A function that is associated with an object; verb
object literal
Define and create an instance at the same time var person = {Name: “Bill”, Age: 5}
object constructor
function Person (name, age) {this.name = name; this.age = age;}