var obj = {
"MapName": "Adeyyo",
"JDVersion": 2019,
"OriginalJDVersion": 2019,
"Artist": "Ece Seçkin",
"Title": "Adeyyo",
"Credits": "Written by Aysen Şimşekyay, Kemal Şimşekyay and arranged by Ozan Doğulu. Published by DMC & PRM. Courtesy of DGL. All rights of the producer and other rightholders to the recorded work reserved. Unless otherwise authorized, the duplication, rental, loan, exchange or use of this video game for public performance, broadcasting and online distribution to the public are prohibited.",
"NumCoach": 1,
"BannerVideo": 0,
"CoachBeat": 1210,
"OnlineMap": 0,
"Tags": [
"main"
],
"PictogramBar": 1,
"PictoDuration": 3000,
"BeatDuration": 3000,
"LyricDuration": 1750,
"PictoResolutionX": 256,
"PictoResolutionY": 256,
"PictoResolutionUHD": 0,
"VideoType": "mp4",
"AudioType": "ogg",
"LyricColors": [111, 255, 182],
"LyricSpeed": 100,
"goldmoves": [166105, 226105],
"Difficulty": 1,
"DefaultColors": {
"lyrics": "0xFF6FFFB6",
"theme": "0xFFFFFFFF",
"songColor_1A": "0xFF010342",
"songColor_1B": "0xFF411554",
"songColor_2A": "0xFF97FAFC",
"songColor_2B": "0xFF11B7C6"
}
}
var value = 0;
for (let key in obj) {
if (key === "LyricDuration") value += obj[key]
}
// value === 1750
<button type="submit" id="save" onclick="func1()">Save</button>
const func1 = () => {
const name = document.getElementById("name").value;
const lastname = document.getElementById("lastname").value;
const link = document.getElementById("link").value;
console.log(`Name: ${name}\nLast Name: ${lastname}\n Link: ${link}`)
}
var str = "{cat: 5}";
var items = [];
var tokens = str.match(/{[^}]+}/g);
for (var i = 0; i < tokens.length; i++) {
var segments = tokens[i].split(',');
var item = {};
for (var j = 0; j < segments.length; j++) {
var pair = segments[j].replace(/{|}/, '').split(':');
item[pair[0].trim()] = pair[1];
}
items.push(item);
}
var obj = items;
console.log(obj);
robot.on('message', message => {
if (message.content.toLowerCase() === '!habr') {
const exampleEmbed = new Discord.MessageEmbed()
.setTitle('Marasite Support')
.setColor('#DC143C')
.setDescription('Какое-то описание чего-то.');
message.channel.send(exampleEmbed);
}
});
let example = 3;
if (example > 1) {
alert("Yes!"); // Yes! - работает.
}
if (condition) {
let example = 3;
}
if (example > 1) { // Uncaught ReferenceError: example is not defined
alert("Yes!");
}