Loading repository data…
Loading repository data…
Attriumph / repository
:microphone: Prepare for the interviews and sum up the most popular interview problems for front-end(HTML/CSS/Javascript), Web development, full-stack. Also did some typical coding practice questions, such as UI caculator
This repo was summarized during the process of preparation for interviews, including common interview questions for software engineer(Front-end), Web engineer and UI engineer and so on. Hopefully, it is helpful for you. And please feel free to commit pr if you find problems or you want to add more content for this repo.
// an example
var arr = [3, 5, 7];
arr.foo = 'hello';
for (var i in arr) {
console.log(i); // logs "0", "1", "2", "foo"
console.log("length is ",arr.length) //3
}
for (var i of arr) {
console.log(i); // logs 3, 5, 7
}
function lazy_sum(arr) {
var sum = function () {
return arr.reduce(function (x, y) {
return x + y;
});
}
return sum;
}
var f = lazy_sum([1, 2, 3, 4, 5]); // function sum()
f(); // 15
function multiply(multiplier, ...theArgs) {
return theArgs.map(x => multiplier * x);
}
var arr = multiply(2, 1, 2, 3);
console.log(arr); // [2, 4, 6]
Spread Operator: consists three dots (...). The spread operator allows us to spread out elements of an array or a string.
Object Literal: The object literal is one of the most popular patterns for creating objects in JavaScript because of its simplicity.
function createMachine(name, status) {
return {
name,
status
};
}
ES6 introduced a new construct for...of that creates a loop iterating over an iterable object such as an Array, a Map, a Set, or an object that implements the iterator.
destructing assignment: that allows us to take an object or an array and destructure it into individual variables.
Template Literals: a template literal uses backticks , it has the following features:
ES6 modules: export variables, functions, classes from a module and reuse them in other modules.
introduce class and also extends and super key words:
class Animal {
constructor(type) {
this.type = type;
}
identify() {
console.log(type);
}
}
Symbol: ES6 add