UI Engineer Flashcards

0
Q

What’s a closure? Why use it?

A

A closure is when an inner function accesses variables just outside its scope. You can create private variables & functions with closures.

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

What’s “undeclared” versus “undefined” re: variables?

A

Undeclared does not exist yet. If you give a value to an undeclared variable, it puts it on the global object. To avoid that, declare it first with var. A variable only declared will still be undefined until it is given a value.

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

What are cookies, localStorage, and sessionStorage?

A

Cookies are the legacy way browsers keep user data in the form of a key value pairs. It has a built in convention for expiration. LocalStorage & sessionStorage are newer APIs that are in some ways easier to use and without the limitations cookies have. LocalStorage can keep a key value pair, but without built in expiration. SessionStorage can also keep a key value pair but they expire with the session.

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

What’s JSONP? Why is it not considered AJAX?

A

Stands for JSON w/ padding. The “padding” is the call to function that receives the data as its first argument.

It is not AJAX because it does not use the XHR API. It’s really just remote JavaScript. It’s easy and can be used cross domain without issue. Because of that, there maybe valid security concerns.

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

What is “Standards” versus “Quirks” mode?

A

A browser has both. With a valid doctype, it will render in standards mode based on W3C guidelines. Without a valid doctype it will render in quirks mode without strict regard for W3C guidelines. Sometimes invalid markup will trigger quirks mode.

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

Why not extend built in JavaScript objects?

A

Avoid it for future proofing and name collision. The Prototype library extended Function with a “bind” method. At a later point ECMA5 introduces the same method on Function, but with some variation making it a breaking change for those using the library.

Also, it can effect looping through enumerable properties of an object in a negative or unexpected way.

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

What is the JS module pattern?

A

Uses a closure to create a protected scope for local variables and functions while still maintaining access to globals. A return value exposes public methods to indirectly access protected logic.

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

What is a doctype?

A

It is a preamble that establishes the standard format a browser uses for rendering its content.

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

What are the building blocks of HTML5?

A

Semantically, the building block are: header, footer, nav, article, section, & aside.

But more exciting are the new APIs, audio, video, canvas…

Rich web content without flash.

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

What’s GET & POST?

A

The two most common form methods.

GET - requests data from a resource.
POST - submits data to a resource.

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

What is an anonymous function?

A

It is an unnamed/undeclared function.

They’re most commonly used as arguments to other function calls. For example, callbacks.

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

What is JS inheritance?

A

Unlike classical inheritance, JavaScript is prototype-based. Instead of inheriting from classes, objects inherit from other objects using the prototype chain.

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

What is the box model?

A

It’s the box that wraps around HTML elements. It’s made up of margins, borders, padding and then content; in that order.

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

What is JavaScript and Jquery?

A

JavaScript is the standard programming language of the web.

Jquery is library written in JavaScript. It makes DOM manipulation easy.

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

What is an undeclared, undefined, & null variable?

A

Undeclared variables don’t exist yet. To make it exist declare it with var. If only declared, a variable remains undefined. To make it defined prior to its final value, set it equal to null. Null means nothing, but is an actual value.

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

What is JavaScript hoisting?

A

It’s how JavaScript automatically moves declarations to the top. It allows you to reference a variable or function before it is declared.