what will be printed in console
if (true) {
const name = 'john';
let number = '123';
var email = '[email protected]';
}
console.log(email, number, name);
what will be printed in console
for (var i = 0; i < 5; i++) {
setTimeout(() => {
console.log(i);
})
}
const persons = [
{
name: 'John Doe',
email: '[email protected]',
salary: '100000',
},
{
name: 'Jane Doe',
email: '[email protected]',
salary: '90000',
},
];
-
How to get array of names
const names = ['John Doe', 'Jane Doe']
-
How to get Object map
const nameMap = { [email protected]: 'John Doe', [email protected]: 'Jane Doe' }
-
How to get items where salary is higher than 1000
const result = persons.filter(item => item.salary > 1000);
-
How to cache upper search result for later use
const createSearch = () => {
const cache = {};
return (amount) => {
if (!cache[amount]) {
cache[amount] = contacts.filter(item => item.salary > amount);
}
return cache[amount];
}
};
- describe how can inheritance be achieved
const Vehicle = function (color, wheelCount) {
this.color = color;
this.wheelCount = wheelCount;
};
Vehicle.prototype = {
getColor: function () {
return this.color;
},
getWheelCount: function () {
return this.wheelCount;
}
};
const Car = function (color) {
Vehicle.call(this, color, 4);
};
Car.prototype = Object.assign({}, Vehicle.prototype);
Car.prototype.constructor = 'Car';
const car = new Car('red');
console.log(car instanceof Car);
- How to add to new method to Array
Array.prototype.reduce = function() {}
-
what is callback hel, describe, how to fix it
-
What is going to be the sequence of the requests
fetch('//google.com')
.then(function () {
fetch('//yandex.ru')
})
.then(function () {
fetch('//facebook.ru')
})
.then(() => {
fetch('//twitter.ru')
});
- Will the thens after throw error work, what is going to be after catch
fetch('//google.com')
.then(function () {
throw new Error('some error');
})
.then(function () {
fetch('//facebook.ru')
})
.then(() => {
fetch('//twitter.ru')
}).catch(() => {
console.error('error occured');
}).then(() => {
fetch('//yandex.ru');
});
- convert promise to async await
fetch('https://google.com')
.then((json) => {
return json()
})
.then((data) => {
return data
})
- Tell about box model
- inline, block, inline-block
- Flex box, Grid, any differences
- transition, transform, animations
- Preprocessors
- Custom fonts, font sizing
- Mobile first
- Print css
- Virtual DOM
- setState sync or async function
- Profits of react, UNIT test, components just functions, performance with virtual dom
- jsx what is it
- what is state and props, props are immutable,
- arrow function in react
- refs
- Pure Component
- HOC, why are they needed
- flux
- reducer, Store, action,View
- Explain flux
- Explain Actions, Store, Reducer, Container
- Middleware
- How we go back in time
- Git, release-1.0, master, need to send bugfix to release-1.0.1
- Bundling tools, webpack, rollap, gulp, grunt
- npm 5, 6 anything, custom packages inhouse or smth about that
- CI/CD tools, any experience
- linting tools, eslint
- testing tools, jest or others, talk about unit tests
- what is session
- what is cookies
- authorization process