Section 1

Preview this deck

Can we overload functions in JS? What happens with more/fewer arguments?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 14, 2020

Cards (30)

Section 1

(30 cards)

Can we overload functions in JS? What happens with more/fewer arguments?

Front

To few, missing field is undefined To many, extra field is ignored

Back

What's an event in JS? What are some events you're familiar with? How to have alert pop up when user clicks button? What's an event listener? Params to event listener?

Front

Events are user actions, usually from keyboard and mouse onClick, onLoad, onBlur, onHover document.getElementById("Button").addEventListener("click",() => {alert("Clicked")}); Handler for events in javaScript. Calls an action when an event occurs type of event, function, and Boolean for asynchronous or not

Back

Features of JS? What are ES6 features?

Front

Header, Footer, Section, Audio, Video, Article, Nav arrow functions template literals

Back

How to select elements from document? What about modifying element?

Front

document.getElementById() .getELementByClassName() .getElementByTagName() CSS selector .innerhtml or modifying attributes

Back

From which object can we stop propagation?

Front

Back

What is functional programming?

Front

Process of building software by composing pure functions, avoiding shared states, mutable data, and side effects. Functional programming is declarative rather than interpreted, and application state flow through pure functions.

Back

What is strict mode?

Front

'use strict' -Strict mode eliminates some JavaScript silent errors by changing them to throw errors. -Strict mode fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode. -Strict mode prohibits some syntax likely to be defined in future versions of ECMAScript. -It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object). -It disables features that are confusing or poorly thought out. -Strict mode makes it easier to write "secure" JavaScript.

Back

What is bubbling/capturing? Can you control propagation of events?

Front

Bubbling - Execute from inner tag to outer tag Capturing - Executing from outer tag to inner tag You can use stop propagation to stop bubbling or capturing

Back

What is an event in JS? How to handle? How to write it? Parameters?

Front

Events are user actions, usually from keyboard and mouse EventListener document.getElementById("Button").addEventListener("click",() => {alert("Clicked")}); type of event, function, and Boolean for using capture or not - default false

Back

== vs === in JS?

Front

== - coercion - Checks the value === - no coercion - Checks the type first - Checks value next

Back

What's a callback function? Tell me some practical example for callback function?

Front

A callback function, also known as a higher-order function, is a function that is passed to another function as a parameter, and the callback function is called (or executed) inside the other Function. -Event Listener -onReadyStateChange

Back

what are different variable scopes? Ways to declare variables? What do they mean?

Front

Global, Block, Lexical

Back

explain truthy/falsy?

Front

Truthy -Anything that is true in a conditional statement Falsy - 0, "", false all equate to false Null and Undefined only equal to themselves NaN does not equal anything not even itself

Back

How to add element to the DOM?

Front

Create an element append child

Back

Is JS same as Java? Why?

Front

No JS is interpreted They have different variables

Back

What's the DOM? What's root element of DOM? How to add elements dynamically? How to set the ID programmatically?

Front

Document Object Module Document Document.createElement(); Document.getElementById().appendChild() Document.getElementById().id = "newId"

Back

Does JS have constructors? Inheritance? How does JS engine look up property?

Front

Only cunstroctor is object. JS supports prototypical inheritance -Objects have a private field that point to another prototype. -This goes on until one prototype points to null

Back

Describe the difference between regular function and arrow functions?

Front

function - declared using function - have to declare a return Arrow - declare using () => {} - saves space - returns are automatic

Back

What is type coercion? What happens?

Front

Converting one type to another Used by == to compare values implicit or explicit

Back

Difference between var/let?

Front

Var - can be redeclared with var - function scope Let - let can not be redeclared to let or var - block scope - can't be accessed from global scope

Back

Number data type matches what in Java?

Front

Double

Back

what's JSON? Why use JSON?

Front

JavaScript Object Notation String version of a javaScript object Send information Human readable

Back

Latest version of JS? Most useful latest? ES6 features?

Front

1.8 1.6

Back

What is template literal?

Front

Template literals are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them. Use tick to start Can take new line Can take in variables Can take in expressions

Back

what's function hoisting?Or what is hoisting? Any way to avoid hoisting? Do you consider hoisting a feature or an issue of language?

Front

Calling a function before it has been declares Set the function as a variable

Back

What's a closure? What are you achieving with this?

Front

Creating a lexical scope for variable. Function with variable and inner function that can access the variable. Variable cannot be accessed outside of the inner function. You can achieve encapsulation

Back

what is special about functions in javascript? Or why is function special in JS?

Front

Functions are objects Can be anonymous Callback

Back

What's JavaScript? How is Java related? JS is OOP? JS compiled? What is data type in JS?

Front

JS is an interpreted language used alongside HTML to make dynamic web pages. Java was added to the name soley on it's popularity at the time. JS is now OOP but it used to be OBP. JS is an interpreted language, browsers use JIT to run it Number, String, Function, Object, Null, Undefined

Back

How can objects be created in javascript? What are the other ways to create objects?

Front

Object literals new Object() Object constructor

Back

What does dynamically typed or loosely typed mean? Is that a benefit or issue?

Front

Type checking is done at run-time. Interpreted static typing - type check is done at compile time

Back