JavaScript

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

ECMA2015 features added

Constants scoping and arrow functions

what is JavaScript

JavaScript is a scripting, interpreted language that allows you to perform complex features on web pages i.e. video play, scrolling, animations.

what is javascript single-threaded model and the event loop.

Single threaded model is it does one thing at a time, it has one call stack. if the stack encounters traffic it kicks it off (the vehicles to the side) to the task Que for the event loop. Event loop looks at stack and task due, if stack is empty it takes stuff in Que and puts it in the stack

what are modules

a module is code that we group together for the purposes of sharing and reuse, (i.e. socks and shirt in diferent cabins but used to make an outfit).

what is a web service

a more specific api that allows you to run your service on the internet

what are promises

a promise is just that the promise of something eventually happening, say you ask me for a chicken and I give you an egg, in a sense I've giving you the promise of a chicken. with promises one of two things can happen, either it's fulfiled and we move on with the program or the promise is broken and it fails. we can use .catch to handle errors thrown by promises.

what are objects

a set of name/valeu pars that store non-primitive data let house = {owner: "person", address: "123 abc str."}

what's an environmental variable

a variable whose value is set outside the program, you access them by process.env and suffixing the name of the variable.

what is varargs

ability to recieve any number of arguments the excess will be accessed through array like object named arguments..

what's an error in js

an error indicates something in your code, functioning abnormally

what is typescript

an extension of javascript that's more strict on conventional programming rules. uses babel to be transpiled

what's an event

an occurence that happens at some point while your program is executing.

modules.exports

are the part of the commonjs specification and the instruction tells nodejs which bits of code to export for use by other files.

how do you deal with errors that occur

by placing code that might cause an error in a try catch block.

how do you cause an error to happen as the programmer

by using the throw key word, you can throw new Error()

what are abstract classes

classes that cant be instantiated from but inherited from

what is the difference between JS server & client side

client side programming has code such as animations, effects, computations or any sort of interaction the website perfoms with the user via browser. But server side is that which performs all the tasks in the server only, and the user is unaware of.

what's transpiling vs compiling

compiling is the general term for taking source code writen in one code and transforming it to executable lang (hi to lo lvl). Transpiling is translator(hi to hi lvl).

what are exceptions and error handling

exceptions are regular code flow interruptions that the programmer is expected to handle, whereas errors are not expected to be handled

what are some ES6/ECMA2015 features

export and imports are... on node you use different syntaxes

difference between functional programming vs object oriented programming

functional program separates the program down to basic funcitons and primarily uses arrays and dictionaries, however oop uses classes (objects) to store both methods and variables to achieve the programming need.

what are js event listeners and handlers

functions that respond to a specific event after a specific event is triggered.

waht are guard adn default operators

guard var getUsername = function() { return a && b;) will return b if a is true else returns a... var d = a || b will return a if a is true else b.

what is package.json

holds relevant metadata relevant to the project, this file is used to give info to npm that allows it to id the project as well as handle the projects dependience.

exposing/consuming rest

idea of allowing methods to be used in other api's and using others.

javascript functions as constructors

if you want to create params for an object you can do that with the key word function

commonjs vs es6 programming

in es6 we only import name from whatever module. with common js we use const varname = require('')

what's the await key word do

it only works inside an async function and makes JS wait until the promise is settled and returns it results

what does the spread operator do

it spreads lists of arrays into seperate lists out of the array.

what happens when a web browser sees js

it uses the an engine i.e. v8 engine by google to run the js code.

what is jest

it's used to test the functionality of our code for accuracy. you install it with npm I -d jest

what is prototypal inheritance

javascript objects have a special hidden property [[prototype]] that is either null or references another object which is called a prototype. If we want to read a property from an object and it's missing javascript automatically takes it from the prototype this is protypal inheritance.

what is node.js

node is an open source server environment. that runs and executes code beyond the browser via the v8 engine

how do you create a package.json file for your project

npm init

how do you install different packages

npm install

what are more nuanced types

null function object

what is the factory design pattern

opposite of the singleton, it emphasizes the instantiation of classes by making interface classes, for other classes to implement

what is the singleton design pattern

permits for no instantitaiton of a class via making the constructor private only gives access to the objects in the class

what are template literals

string literals allowing embedded expressisons, `string text ${expression} string text`.

features from ES6/ECMA2015

template literals, block scoping, let doesn't require closures at all, arrow functions so no this method, ability to create classes. ES6 is the international governing body of js

what's the async key word do

the async key word can be placed in front of a function and it means a function always returns a promise async function f() { return 1; } f().then(alert); // 1

what is destructuring

the concept of unpacking values from arrays or properties from objects into distict variables. Is a special syntax

what's an arrow function

the creation of a function in shorthand using () = > {}

what's a callback function

the function that's passed in as the argument for other functions is called the callback function.

what are control flow statements

the order in which the compueter executes statments in a script, some structures include conditionals loops and fucntions. switch and if else statements

what is npm

the package manager for node. It puts modules in places so that node can find them and manages dependency conflicts intelligently.

variable scopes

the place where the variable can be used.

whats the v8

the v8 engine turns the script language into useable code in your machine. scripting code can't be executed independently

what is truthy falsey

this means that every variable can be a boolean, they can be true or false. 0 an empty string, null empty stuff

what is dynamic and loose tying in javascript

this means variables are not associated with any particular type and can be reassigned to values with different types. let mV = 9001; mV = "now its this" mV = false this is ok.

what's the difference between typescript and javascript

typescript is a superset of javascript that needs to be compiled by babel as oppose to javascript which needs not to be.

what is a rest api

uniform interface, cacheable, stateless, client server(seperate servers) have hierarchy, layered, on demand code.

what's asynchronous programming

usually implemented using callbacks, but allows for the code to continue working without freezing, when some particular action is taking a long time.

what's an anonymous function

usually used for callbacks an anonymous function is a function with the arrow style definition inside the params of a function.

var vs let vs const

var is pretty much scopeless (only var is hoisted) let defines the variable to the scope or block it was created in and const is used when the variable is not changing or expected to change

what's the difference between var let and const

variabels declared with var can be hoisted and redeclared variables declared with the const can't be changed

what is hoisting

variables can be used before being declared.

how do we import modules

we use the key word require, and the path of the function.

what's type coercion

when using double equals one of the variables is attempted to be changed in order to match the other for the comparison to be made.

what are closures

when you have one function within another function, the inner function has access to all the outer functions after the call.

how do you declare variables in js

with or without var this exposes you to hoisting and with the advent of es6 we now have const and let.

how do you perform testing

you would write a test file for the file you're testing then use the test function and withing there have the expect().tobe as well.

what are the 6 primitive types

Undefined Boolean Number String BigInt Symbol

what are JS event emitters

a class from which objects that emit events are made, these objects attach themselves to functions... its the object that announces the occurrence of an event.

what are anonymous functions

a funcitons without a name, var x = funciton (a, b) {return a * b), var z = x((4, 3).

what's the rest parameters

a function can be called with any numebr of args regardless of how many it was defined with.


Ensembles d'études connexes

Use, Cause, Permit, Aid, And Abet

View Set

SE1: Hoofdstuk 3: Grenzen en identiteit

View Set