Over all Review Flashcards

1
Q

What is a string?

A

Strings are blocks of texts. They will always have single or double quotation marks around them.

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

What is a number?

A

Numbers are just numbers, they do not have quotes around them.

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

What is a primitive data type?

A

String, Number, Boolean

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

What is a boolean?

A

true or false

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

What is undefined?

A

A variable that does not have a value yet, what you are looking for doesn’t exist.

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

What is null?

A

______ is an object that we (developers), set as no value.

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

What is the || used for?

A

The logical OR (||) operator for a set of operands is true if and only if one or more of its operands is true

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

What is are comparison operators?

A

__________ are used in logical statements to determine equality or difference between variables or values. They are also used to test for true or false.

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

What is an object?

A

A data type that can be used to store a collection of data.

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

What is key:Value pairs?

A

Objects use key:value pairs to house data. The key is the identifier and the value is the value we want to save to that key.

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

How do you write a key:value pair?

A
const user {
username: 'your name',
password: 'password1234!',
age: 43,
hobby: 'soccer'
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are JavaScript Data Types?

A
Number
String
Boolean
Object
Undefined
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the use of isNaN function?

A

isNan function returns true if the argument is not a number otherwise it is false.

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

Between JavaScript and an ASP script, which is faster?

A

JavaScript is faster. JavaScript is a client-side language and thus it does not need the assistance of the web server to execute.

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

What is negative infinity?

A

Negative Infinity is a number in JavaScript which can be derived by dividing negative number by zero.

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

Where do “data types” come into play?

A

Data you work with in your code is of different - e.g numbers, text, etc.

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

What object do you use to access the short descriptions for standard HTTP status codes?

A

http.STATUS_CODES

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

What are global variables? How are these variables declared and what are the problems associated with using them?

A

Global variables are those that are available throughout the length of the code, that is, these have no scope. The var keyword is used to declare a local variable or object. If the var keyword is omitted, a global variable is declared.

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

What is a prompt box?

A

A prompt box is a box which allows the user to enter input by providing a text box. Label and box will be provided to enter the text or number.

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

What is the global object we can access the current version of node and arguments passed into the command line?

A

process

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

What is ‘this’ keyword in JavaScript?

A

‘This’ keyword refers to the object from where it was called.

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

What HTTPS(https) API is available in which environments?

A

NodeJS

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

What’s the property on the process object that lists all arguments passed into the command line?

A

argv

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

The String object is what type of object?

A

Native

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

What is the difference between ViewState and SessionState?

A

‘ViewState’ is specific to a page in a session.

‘SessionState’ is specific to user-specific data that can be accessed across all pages in the web application.

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

What is === operator?

A

=== is called as strict equality operator which returns true when the two operands are having the same value without any type conversion

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

Explain how can you submit a form using JavaScript?

A

document.form[0].submit();

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

Is there anything you have to be careful when using node.cloneNode()?

A

While cloning, make sure you didn’t duplicate the ID.

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

How could you prevent multiple event handler to be fired for an event?

A

If event listeners are attached for the same type event (click, keydown, etc.) of an element for the same event type, you can call event.stopImmediatePropagation() in the first event handler. No other event handler will be executed.

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

Can you remove an event handler from an element?

A

Yes. target.removeEventListener(‘click’, handler)

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

How could you stop further propagation of an event?

A

Call event.stopPropagation();

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

How could you prevent a click on an anchor from going to the link?

A

preventDefault() inside event handler. However, this doesnt stop further propagation.

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

How could I verify whether one element is child of another?

A

First check whether the passed parent is the direct parent of the child. If not, keep moving upward to the root of the tree.

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

What are the different ways to get an element from DOM?

A
getElementById to get a element that has the provided Id.
getElementsByClassName to get a nodelist (nodelist is not an array, rather it is array-like object) by providing a class name.
getElementsByTagName to get a nodelist by the provided tag name.
querySelector you will pass css style selector (jquery style) and this will retrurn first matched element in the DOM.
querySelectorAll will return a non-live nodelist by using depth-first pre order traversal of all the matched elements. Non-live means, any changes after selecting the elements will not be reflected.
getElementsByName returns the list of elements by the provided name of the html tag
getElementsByTagNameNS returns elements with particular tag name within the provided namespace
35
Q

window.onload vs document.onload

Does document.onload and window.onload fire at the same time?

A

window.onload is fired when DOM is ready and all the contents including images, css, scripts, sub-frames, etc. finished loaded. This means everything is loaded.document.onload is fired when DOM (DOM tree built from markup code within the document)is ready which can be prior to images and other external content is loaded.
Think about the differences between window and document, this would be easier for you.
Bonus:document.readyState Returns “loading” while the Document is loading, “interactive” once it is finished parsing but still loading sub-resources, and “complete” once it has loaded. The readystatechange event fires on the Document object when this value changes.

36
Q

Is there any difference between window and document?

A

Yes. JavaScript has a global object and everything runs under it. window is that global object that holds global variables, global functions, location, history everything is under it. Besides, setTimeout, ajax call (XMLHttpRequest), console or localStorage are part of window.document is also under window. document is a property of the window object. document represents the DOM and DOM is the object oriented representation of the html markup you have written. All the nodes are part of document. Hence you can use getElementById or addEventListener on document. These methods are not present in the window object.

37
Q

Can you explain the concept of a CSS float and provide an example of its usage?

A

CSS float tells the browser to put a particular element to the right side or the left side of the container. I use floats when I’m developing a page that dynamically resizes based on the user resolution.

38
Q

How do you structure your CSS and JavaScript to make it easier for other developers to work with?

A

Organize stylesheets with sections for each site component. Each section has comments throughout the code so other developers can change it.

39
Q

How can JavaScript codes be hidden from old browsers that don’t support JavaScript?

A

For hiding JavaScript codes from old browsers:
Add “” without the quotes in the code just before the tag.
Old browsers will now treat this JavaScript code as a long HTML comment. While, a browser that supports JavaScript, will take the “” as one-line comments.

40
Q

What is namespacing in JavaScript and how is it used?

A

Namespacing is used for grouping the desired functions, variables etc. under a unique name. It is a name that has been attached to the desired functions, objects and properties. This improves modularity in the coding and enables code reuse.

41
Q

How are JavaScript and ECMA Script related?

A

ECMA Script are like rules and guideline while Javascript is a scripting language used for web development.

42
Q

Why it is not advised to use innerHTML in JavaScript?

A

innerHTML content is refreshed every time and thus is slower. There is no scope for validation in innerHTML and, therefore, it is easier to insert rouge code in the document and, thus, make the web page unstable.

43
Q

What are the decodeURI() and encodeURI()?

A

EncodeURl() is used to convert URL into their hex coding. And DecodeURI() is used to convert the encoded URL back to normal.

44
Q

What is unshift() method ?

A

unshift() adds the desired number of elements to the start of an array.

45
Q

What are Screen objects?

A

Screen objects are used to read the information from the client’s screen. The properties of screen objects are -
AvailHeight: Gives the height of client’s screen
AvailWidth: Gives the width of client’s screen.
ColorDepth: Gives the bit depth of images on the client’s screen
Height: Gives the total height of the client’s screen, including the taskbar
Width: Gives the total width of the client’s screen, including the taskbar.

46
Q

What is a switch statement?

A

The switch statement evaluates an expression, matching the expression’s value to a case clause, and executes statements associated with that case, as well as statements in cases that follow the matching case.

47
Q

What are the various functional components in JavaScript?

A

First-class functions: Nested functions:

48
Q

What is a First-class function?

A
First-class functions: Functions in JavaScript are utilized as first-class objects. 
Usually can be passed as arguments to other functions, returned as values from other functions, assigned to variables, or can also be stored in data structures.
49
Q

What is a Nested function?

A

functions that are defined inside other functions. They are called ‘every time’ the main function is invoked.

50
Q

What is a higher-order function?

A

A higher-order function:
Accepts a function as an argument or
Returns a function as a result

51
Q

What is a callback function?

A

A call back function is a function that is passed as an argument to another function, to be “called back” at a later time. A function that accepts other functions as arguments is called a higher-order function, which contains the logic for when the callback function gets executed. It’s the combination of these two that allow us to extend our functionality.

52
Q

Define event bubbling?

A

JavaScript allows DOM elements to be nested inside each other. If the handler of the child is clicked, the handler of the parent will also work as if it were clicked too.

53
Q

What is the difference between .call() and .apply()

A

The function .call() and .apply() are very similar in their usage except a little difference.

.call() is used when the number of the function’s arguments are known to the programmer, as they have to be mentioned as arguments in the call statement.

.apply() is used when the number is not known. The function .apply() expects the argument to be an array.

The basic difference between .call() and .apply() is in the way arguments are passed to the function.

54
Q

Describe the properties of an anonymous function in JavaScript?

A

A function that is declared without any named identifier is known as an anonymous function.

55
Q

Explain the for-in loop?

A

The for-in loop is used to loop through the properties of an object. The syntax for the for-in loop is -

for (variable name in object){
statement or block to execute
}

In each repetition, one property from the object is associated with the variable name, and the loop is continued till all the properties of the object are depleted.

56
Q

Explain window.onload and onDocumentReady?

A

The onload function is not run until all the information on the page is loaded. This leads to a substantial delay before any code is executed.

57
Q

What is the use of blur function?

A

Blur function is used to remove the focus from the specified object.

58
Q

What is a class used for?

A

A class is used to make properties and methods available on objects of that class type.

59
Q

What is the use of typeof operator?

A

‘Typeof’ is an operator which is used to return a string description of the type of a variable.

60
Q

How generic objects can be created?

A
Generic objects can be created as:
var I = new object()
61
Q

What is break and continue statements?

A

Break statement exits from the current loop.

Continue statement continues with next statement of the loop.

62
Q

Does JavaScript have concept-level scope?

A

No. JavaScript does not have concept-level scope. The variable declared inside the function has scope inside the function.

63
Q

What is pop()method in JavaScript?

A

The pop() method takes the last element off of the given array and returns it. The array on which is called is then altered.

64
Q

What are JavaScript Cookies?

A

Cookies are the small test files stored in a computer and it gets created when the user visits the websites to store information that they need.

65
Q

What are the different types of errors in JavaScript?

A

Load time errors: Errors which come up when loading a web page like improper syntax errors are known as Load time errors and it generates the errors dynamically.
Run time errors: Errors that come due to misuse of the command inside the HTML language.
Logical Errors: These are the errors that occur due to the bad logic performed on a function which is having different operation.

66
Q

What are escape characters?

A

Escape characters (Backslash) is used when working with special characters like single quotes, double quotes, apostrophes and ampersands. Place backslash before the characters to make it display.

67
Q

What is the difference between an alert box and a confirmation box?

A

An alert box displays only one button which is the OK button.
But a Confirmation box displays two buttons namely OK and cancel.

68
Q

What are all the types of Pop up boxes available in JavaScript?

A

Alert
Confirm
Prompt

69
Q

What would be the result of 3+2+”7”?

A

Since 3 and 2 are integers, they will be added numerically. And since 7 is a string, its concatenation will be done. So the result would be 57.

70
Q

How can you convert the string of any base to integer in JavaScript?

A
The parseInt() function is used to convert numbers between different bases. parseInt() takes the string to be converted as its first parameter, and the second parameter is the base of the given string.
In order to convert 4F (of base 16) to integer, the code used will be -
parseInt ("4F", 16);
71
Q

What are all the looping structures in JavaScript?

A

For
While
do-while loops

72
Q

How can the style/class of an element be changed?

A

document.getElementById(“myText”).style.fontSize = “20”
Or
document.getElementById(“myText”).className = “anyclass”;

73
Q

What method can you call on a buffer to convert it to a string?

A

toString()

74
Q

Does JavaScript support automatic type conversion?

A

Yes JavaScript does support automatic type conversion, it is the common way of type conversion used by JavaScript developers

75
Q

What is functional scope?

A

Functional scope allows us to create variables of functions., that are essentially private to that function.

76
Q

call will…….

A

immediately invoke the function

.call you pass in your arguments 1 by 1

77
Q

apply will…..

A

immediately invoke the function

.apply you pass in your arguments as an array

78
Q

bind will……

A

doesn’t immediately invoke the function

.bind returns a brand new function that will be invoked later

79
Q

What is a component?

A

A component is made of several parts: HTML, CSS, or JavaScript brought together for reuse in a website or application.

80
Q

What does .unshift() do?

A

will put a new item in the first position of the array

81
Q

What does .shift() do?

A

will remove the first item in the array

82
Q

What does .psuh() do?

A

adds an item to the end of the array, incrementing its length by 1

83
Q

What does .pop() do?

A

removes the last item in the array, decrementing the length by 1

84
Q

What does a for loop do?

A

For…of loops are the final for loop type in JavaScript. This for loop type loops over each item in an array, but in this loop, the variable contains the item in the array, not its index number.