Head First Flashcards

(46 cards)

1
Q

JS Functions: Pass by value or reference

A

Pass by value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

You can find the length of an array using

A

array.length

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Function to generat e uniform random values

A

Math.random

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Function to round to the previous integer

A

Math.floor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The ____ function can used to trigger a print event from the browser

A

print

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To write to the console, you use

A

console.log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can you delete a property of an object?

A

By using the delete keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Variables can only contain _____ to objects

A

References

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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?

A

Yep

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you iterate over the properties of an object?

A

for (var prop in object) { do stuff };

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If two objects have different types, then try to convert them to a single type and compare. The ___ operator does this

A

==

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The condition is true iff the two objects have the same type and value. The __ operator does this

A

===

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The following are falsey by default

A

undefined, null, NaN, ‘’, 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

___ property gives the length of the string

A

length

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The ___ method can be used to index a string

A

charAt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

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

A

indexOf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Give the ____ method two indices, and it will extract and return the string contained within them

A

substring

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The ___ method takes a character that acts as a delimiter, and breaks the string into
parts based on the delimite

A

split

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The ___ method returns a string with all uppercase characters changed to lowercase

20
Q

The ___ method finds substrings and replaces them with another string.

21
Q

The ___ method returns a new string that has part of the original string removed.

22
Q

The ___ method is like indexOf, but finds the last, not the first, occurrence.

23
Q

The ___ method joins strings together

24
Q

The ____ method searches for matches in a

string using regular expressions

25
The ____ method returns a string with all lowercase characters changed to uppercase.
toUpperCase
26
The ____ method removes whitespace from around the string. Handy when processing user input.
trim
27
When you want to handle time based events, you call the ____ function and pass it two things. What are those?
setTimeout, event handler function and time period in milliseconds
28
Get this event when you click (or tap) in a web page
click
29
The event you get when the browser has completed loading a web page.
load
30
When you move your mouse over an element, you’ll generate this event
mousemove
31
This event is generated | every time you press a key
keypress
32
This event is generated when you close the browser window, or navigate away from a web page
unload
33
When you put your mouse over an element, you’ll generate this event
mouseover
34
And you’ll generate this event when you move your mouse off an element.
mouseout
35
Whenever you resize your browser window, this event is generated.
resize
36
Got in your page? | You’ll get these events when you click the play and pause buttons respectively.
play and pause
37
If you drag an element in the page, you’ll generate this event.
dragstart
38
On touch devices, you’ll generate these events when you touch and hold an element and stop touching respectively
touchstart and touchend
39
You’ll get this event when you drop an element you’ve been dragging
drop
40
The _____ constructor is used to create objects
Object
41
The _____ constructor is used to construct Math objects
Math
42
Use this constructor to create regular expression objects, which allow you to search for patterns, even complex ones, in text.
Regexp
43
This constructor creates standard error objects that are handy when catching errors in your code.
Error
44
You can use the __________ method that every object has. The _______ method returns true if a property is defined in an object instance.
hasOwnProperty
45
Every prototype chain you create in JavaScript will end in _______
Object
46
The following properties of Object should not be overridden in any object which inherits from Object
constructor, hasOwnProperty, isPrototypeOf, propertyIsEnumerable