Head First Flashcards
(46 cards)
JS Functions: Pass by value or reference
Pass by value
You can find the length of an array using
array.length
Function to generat e uniform random values
Math.random
Function to round to the previous integer
Math.floor
The ____ function can used to trigger a print event from the browser
To write to the console, you use
console.log
How can you delete a property of an object?
By using the delete keyword
Variables can only contain _____ to objects
References
Pass by value applies for objects. But, changing the property of an object in a function changes the property in the original object. Is this true?
Yep
How do you iterate over the properties of an object?
for (var prop in object) { do stuff };
If two objects have different types, then try to convert them to a single type and compare. The ___ operator does this
==
The condition is true iff the two objects have the same type and value. The __ operator does this
===
The following are falsey by default
undefined, null, NaN, ‘’, 0
___ property gives the length of the string
length
The ___ method can be used to index a string
charAt
The ___ method takes a string as an argument and returns the index of the first character of the first occurrence of that argument in the string
indexOf
Give the ____ method two indices, and it will extract and return the string contained within them
substring
The ___ method takes a character that acts as a delimiter, and breaks the string into
parts based on the delimite
split
The ___ method returns a string with all uppercase characters changed to lowercase
toLowerCase
The ___ method finds substrings and replaces them with another string.
replace
The ___ method returns a new string that has part of the original string removed.
slice
The ___ method is like indexOf, but finds the last, not the first, occurrence.
lastIndexOf`
The ___ method joins strings together
concat
The ____ method searches for matches in a
string using regular expressions
match