fs.readFile("./files_to_help/QuoteNum.txt", {encoding: "utf8"}, (err, data) => {
const intData = +data.toString();
console.log(intData);
// or make some other things to data...
});
function loadFile(url, id, callback) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.send();
request.onreadystatechange = function() {
if (this.readyState != 4) return;
if (this.status != 200) {
console.log('Ошибка: ' + (this.status ? this.statusText : 'запрос не удался'));
return;
}
document.getElementById(id).innerHTML = this.responseXML;
callback();
}
}
Promise.resolve('Hello world').then(console.log).then(console.log);
const copyObject = JSON.parse(JSON.stringify(object))
const copyObject = Object.assign({}, object);
<script src="http://api-maps.yandex.ru/2.0/?load=package.full&lang=ru-RU" type="text/javascript"></script>
<script type="text/javascript">
ymaps.ready(init);
function init() {
var myMap = new ymaps.Map("map-1", {
center: [56.830175456095785, 60.593889812164235],
zoom: 16
});
myMap.behaviors.disable('scrollZoom', 'drag');
var myMap2 = new ymaps.Map("map-2", {
center: [56.830175456095785, 60.593889812164235],
zoom: 16
});
myMap2.behaviors.disable('scrollZoom', 'drag');
}
</script>
<div id="map-1" style="height: 500px;"></div>
<div id="map-2" style="height: 500px;"></div>
return new Promise((resolve, reject) => {
const image = document.createElement('img');
image.onload = resolve;
image.onerror = reject;
image.src = url;
});