JavaScript 2 Flashcards
1
Q
- What is JSON?
A
- JavaScript Object Notation, A text-based data format following JavaScript object syntax, it exists as a string
2
Q
- What are serialization and deserialization?
A
- Converting a native object to a string is serialization while converting a a string to a native object is called deserialization
3
Q
- Why are serialization and deserialization useful?
A
- To transmit data across a network and to receive it from the network.
*
4
Q
How do you serialize a data structure into a JSON string using JavaScript?
A
- JSON.stringify();
5
Q
- How do you deserialize a JSON string into a data structure using JavaScript?
A
- JSON.parse();
6
Q
- How to you store data inlocalStorage?
A
- localStorage.setItem();
7
Q
- How to you retrieve data fromlocalStorage?
A
- localStorage.getItem();
8
Q
- What data type canlocalStoragesave in the browser?
A
- Strings
9
Q
- When does the’beforeunload’event fire on thewindowobject?
A
- It fires a window before everything is unloaded to cancel the event before the browser unloads all the information stored.
10
Q
- What DOM element property tells you what type of element it is?
A
- . .tagName;
11
Q
- Describe methoddefinitionsyntax (structure).
A
- Stored in an object a property and anonymous function definition
12
Q
- Describe methodcallsyntax (structure)
A
- .method();
13
Q
- What is thedefining characteristicof Object-Oriented Programming?
.
A
- objects can contain both data (as properties) and behavior (as methods).
14
Q
- What are the four “principles” of Object-Oriented Programming?
A
- Abstraction, inheritance, encapsulation and polymorphism
15
Q
- What is “abstraction”?
A
- Being able to work with complex things in simple ways. Like a light switch or automatic transmission.