var a = prompt('Введите число а:');
var b = prompt('Введите число b:');
//меняем местами
a = [b, (b = a)][0];
alert(a);
alert(b);
var a = parseFloat(prompt('Введите число а:'));
var b = parseFloat(prompt('Введите число b:'));
//меняем местами
b = a + b;
a = b - a;
b = b - a;
alert(a);
alert(b);
const zlib = require('zlib');
const fs = require('fs');
/**
* Read the gz compresed file
* @param filename (string) full path to file
* @return (Promise<Buffer>)
*/
function readGZipFile(filename) {
return new Promise((resolve, reject) => {
fs.readFile(filename, (err, buf) => {
if(err) {
reject(err);
return;
}
zlib.gunzip(buf, (err, buf) => {
if(err) {
reject(err);
return;
}
resolve(buf);
});
});
});
}
//Использование
const path = require('path');
readGZipFile(path.resolve(__dirname, 'lib.txt.gz')).then(buf => JSON.parse(buf.toString())).then(data => {
//Ваш код для работы с data
});
io.sockets.on('connection', function(socket) {
var group = 'fnatic';
var url = 'http://steamcommunity.com/groups/' + group + '#members';
request(url, function(err, resp, body){
$ = cheerio.load(body);
links = $('a');
var users = [];
$(links).each(function(i, link){
// console.log($(link).attr('href'));
users.push($(link).attr('href'));
});
socket.emit('hatler', users);
});
});
JSON.stringify([
creditGetImage,
creditGetItemTitle,
creditGetPrice,
creditResultShow,
creditResultShowSecond
], null, 4);
var ArticleContent = React.createClass({
renderContent: function(){
if (typeof this.props.content == 'string'){
// 1. цельная строка без абзацев спокойно рендерится
return <p>{this.props.content}</p>
} else {
return (
<div>
{
this.props.content.map(function(item, i){
// 2. массив строк: каждая строка выводится в консоль, но не рендерится
console.log(item);
return <p key={i}>{item}</p>
}).join('');
}
</div>
);
}
},
render: function(){
return (
<div>
{this.renderContent()}
</div>
);
}
});