This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1 | |
const num = 42 | |
// let result | |
// | |
// if (num > 20) { | |
// result = 'More than 20' | |
// } else { | |
// result = 'Less than 20' | |
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const requestURL = 'https://jsonplaceholder.typicode.com/users' | |
function sendRequest(method, url, body = null) { | |
const headers = { | |
'Content-Type': 'application/json' | |
} | |
return fetch(url, { | |
method: method, | |
body: JSON.stringify(body), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const day = d => moment(d, 'dddd').format('ddd') | |
const decimal = time => moment().startOf('d').add(time, 'h') | |
const interval = ({start, end}) => { | |
const f = 'h:mm A' | |
return `${decimal(start).format(f)} - ${decimal(end).format(f)}` | |
} | |
const toHTML = item => `<li>${item}</li>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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>JavaScript Debugging</title> | |
<link | |
rel="stylesheet" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const person = { | |
name: 'Владилен' | |
} | |
function info(phone, email) { | |
console.log(`Имя: ${this.name}, Тел.:${phone}, Email: ${email}`) | |
} | |
// Demo | |
// info.bind(person)('12345', '[email protected]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createProgrammer(name) { | |
const programmer = {name} | |
return { | |
...programmer, | |
...canCode(programmer) | |
} | |
} | |
function canCode({ name }) { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const citiesRussia = ['Москва', 'Санкт-Петербург', 'Казань', 'Новосибирск'] | |
const citiesEurope = ['Берлин', 'Прага', 'Париж'] | |
const citiesRussiaWithPopulation = { | |
Moscow: 20, | |
SaintPetersburg: 8, | |
Kazan: 5, | |
Novosibirsk: 3 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calcValues(a, b) { | |
return [ | |
a + b, | |
a - b, | |
a * b, | |
a / b | |
] | |
} | |
const [sum, sub = 'Вычитания нет', mult, ...other] = calcValues(42, 10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myNumber = 42 | |
localStorage.removeItem('number') | |
console.log(localStorage.getItem('number')) | |
localStorage.setItem('number', myNumber.toString()) | |
console.log(localStorage.getItem('number')) | |
localStorage.clear() | |
const object = { | |
name: 'Max', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Rare html tags</title> | |
<style> | |
dialog::backdrop { |