MyCarousel = (function(){
elementsCache = {};
function doInitJob(elem) {
console.log("initializtion", elem);
};
function doServiceJob(elem) {
console.log("service", elem);
};
return function(selector) {
if (!elementsCashe[selector]) {
elementsCashe[selector] = document.querySelector(selector);
doInitJob(elementsCashe[selector]);
} else {
doServiceJob(elementsCashe[selector]);
}
}
})();
new Promise(function(resolve){
setTimeout(function() {
console.log(1);
resolve();
}, 1000);
}).then(function() {
let nextPromise = new Promise(function(resolve){
setTimeout(function() {
console.log(2);
resolve();
}, 1000);
});
return nextPromise;
}).then(function() {
let nextPromise = new Promise(function(resolve){
setTimeout(function() {
console.log(3);
resolve();
}, 1000);
});
return nextPromise;
}).then(function() {
setTimeout(function() {
console.log(4);
}, 1000);
});
case DELETE_STRUCTURE_COUPLE:
return {
...state,
structure: objectPath.del(state.structure, action.level)
};
var a = new Number(1)
var b = new Number(1)
console.log(a == b)//пишет false
{} + 1
({}) + 1 // => "[object Object]1"
this.state.val1
вызывай что-то в духеthis.getVal1()
class MyComp extends React.Component {
...
getVal1() {
return this.state.val2 == 1;
}
}