function foo() {
"use strict";
0321;
}
//Uncaught SyntaxError: Octal literals are not allowed in strict mode.
document.querySelectorAll('span.overallAmount')[0].textContent = '100 000';
const boxes = document.querySelectorAll('.box');
boxes.forEach((box, index) => box.addEventListener('click', function(e) {
console.log(index + 1);
this.style.backgroundColor = 'red';
}));
const consoleLogs = [];
console.customLog = console.log.bind(console);
console.log = function(...args) {
console.customLog(...consoleLogs[consoleLogs.length] = args);
}
console.log('toster');
consoleLogs //[['toster']]
const val = document.querySelector('input').value.trim().toLowerCase().split(/\s+/);
const res = arr.filter(o => val.some(s => o.firstName.toLowerCase().includes(s) || o.lastName.toLowerCase().includes(s)));
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>Play battleship!</h1>
<script src="battleship.js"></script>
</body>
</html>
var location1 = 3;
var location2 = 4;
var location3 = 5;
var guess;
var hits = 0;
var guesses = 0;
var isShunk = false;
guess = prompt("Input number:");
while (isShunk == false) {
if (guess > 7) {
alert("Input normal number!");
} else {
guesses = guesses + 1;
}
}
class Example {
constructor() {
this.date = Date.now();
}
}
const o = new Example;
o.date //1548185841559 Unix time(миллисекунды)
const obj = {date: Date.now()};
const results = year.map(inner =>
years.reduce((a, c) => a.concat(c.filter((v, i) => v == inner[i]).length > 1 ? [c] : []), []));
const o = {};
function copy(t, ...r) {
for (k in r) t[k] = r[k];
}
copy(o, {name: 'John'}, {n: 42});
o //0: {name: "John"} 1: {n: 42}
Object.assign();
const arr = [];
const obj = {name: 'John', surname: 'Doe'};
if (arr.every(o => o.name != obj.name || o.surname != obj.surname)) arr.push(obj);
[].every(v => v); // true