value.replace(/\n/g, '<br/>');
console.log(string.replace(/\n/g, '*тут был символ переноса строки*'));
const resolve = result => console.log('result: ', result);
const reject = err => console.log('rejected with: ', err);
const promise1 = () => new Promise((resolve, reject) => {
console.log('promise1');
const zn = +prompt('digit');
if (zn > 9) {
resolve(zn);
}
else {
reject('Ooops!');
}
});
const promise2 = value => new Promise((resolve, reject) => {
console.log('promise2 received value:', value);
const zn = +prompt('digit');
if (zn > 9) {
resolve(value + zn);
}
else {
reject('Ooops!');
}
});
promise1().then(promise2).then(resolve).catch(reject);
foo ();
foo();
const countriesSelector = state => state.stores.map(store => store.country)
.filter((country, index, array) => array.indexOf(country) === index);
const mapStateToProps = state => ({
countries: countriesSelector(state),
});