Promise is a JavaScript object for asynchronous operation state: pending -> fulfilled or rejected Producer vs Consumer 1. Producer when new Promise is created, the executor runs automatically const promise = new Promise((resolve, reject) => { // doing some heavy work (network, read files) console.log('doing something....'); setTimeout(() => { // resolve('ellie'); reject(new Error('no network'));..
JavaScript is synchronous Execute the code block in order after hoisting hoisting : var, function declaration console.log('1'); setTimeout(() => console.log('2'), 1000); console.log('3'); // 1, 3, 2 Synchronous callback function printImmediately(print) { print(); } printImmediately(() => console.log('hello')); Asynchronous callback function printWithDelay(print, timeout) { setTimeout(print, time..
JSON (JavaScript Object Notation) simplest data interchange format lightweight text-based structure easy to read key - value pairs used for serialization and transmission of data between the network and the network connection independent programming language and platform 1. Object to JSON stringify (obj) let json = JSON.stringify(true); console.log(json); // true json = JSON.stringify(["apple", ..
Quiz // Q1. make a string out of an array const fruits = ['apple', 'banana', 'orange']; const result = fruits.join(); console.log(result); // 'apple,banana,orange' // Q2. make an array out of a string const fruits = '🍎, 🥝, 🍌, 🍒'; const result = fruits.split(','); console.log(result); // ["🍎", " 🥝", " 🍌", " 🍒"] // Q3. make this array look like this: [5, 4, 3, 2, 1] const array = [1, 2, 3, 4, 5]; ..
Array 1. Declaration const arr1 = new Array(); const arr2 = [1, 2]; 2. Index position const fruits = ['apple', 'banana']; console.log(fruits); // 'apple', 'banana' console.log(fruits.length); // 2 console.log(fruits[0]); // 'apple' console.log(fruits[1]); // 'banana' console.log(fruits[2]); // undefined console.log(fruits[fruits.length - 1]); // 'banana' 3. Looping over an array print all fruits..
class template declare once no data in introduced in ES6 syntactical sugar over prototype-based inheritance 1. class declarations class Person { // constructor constructor (name, age) { // fields this.name = name; this.age = age; } // methods speak() { console.log(`${this.name}: hello! `); } } const ellie = new Person('ellie', 20); console.log(ellie.name); // ellie console.log(ellie.age); // 20 ..
Function fundamental building block in the program subprogram can be used multiple times performs a task or calculates a value 1. Function declaration function name(param1, param2) { body ... return; } one function === one thing naming: doSomething, command, verb e.g.createCardAndPoint ->. createCard, createPoint function is object in JS function printHello() { console.log('Hello'); } printHello..
1. String concatenation console.log('my' + ' cat'); // my cat console.log('1' + 2); // 12 console.log(`string literals: 1 + 2 = ${1 + 2}`); // 1 + 2 = 3 2. Numeric operators console.log(1 + 1); // add : 2 console.log(1 - 1); // substract : 0 console.log(1 / 1); // divide : 1 console.log(1 * 1); // multiply : 1 console.log(5 % 2); // remainder : 1 console.log(2 ** 3); // exponentiation : 8 3. Inc..
- Total
- Today
- Yesterday
- GCP
- HTTP 완벽 가이드
- 패스트캠퍼스 컴퓨터공학 완주반
- 프로그래머스
- REST API
- 드림코딩
- 프로그래머스 SQL
- 이펙티브자바
- Spring Security
- 모던자바스크립트
- dreamcoding
- 이펙티브자바 스터디
- js api
- BOJ
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- js promise
- js array
- 김영한 JPA
- JS 딥다이브
- 킹수빈닷컴
- http
- 김영한 http
- java
- 이펙티브자바 아이템60
- HTTP 완벽가이드
- 이펙티브자바 아이템59
- 집 구하기
- JPA 연관관계 매핑
- 백준
- 백기선 스터디
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |