일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 정치학
- 코테
- 데이터분석전문가가이드
- 백준
- 당신이 몰랐던 진화론
- 빅데이터
- KMOOC
- CNN10
- 누가 진정한 리더인가
- 조지프 나이
- ADsP
- 알고리즘
- Progate
- Great Minds
- K-MOOC
- Udemy
- 공부정리
- Hacker Rank
- 후기
- Joseph Samuel Nye Jr.
- python
- EBS
- 미분적분학
- ADP
- MySQL
- Baekjoon
- 맛집
- 데이터분석전문가
- 자료구조
- 위대한 수업
- Today
- Total
ㅇ
JavaScript / Progate 본문
- running JS code
console.log(~~);
" ~~ " or ' ~~ '
- variable
let variableName = value;
- constants
const constantName = value;
// it can not be changed
- templete
` ~~~ ${constants or variables}`
// can embed in strings
// must put the entire in backticks, `
- if statements
if(condition1)
{
// when condition1 is true
} else if (condition2) {
// when the condition1 is false
// and condition2 is true
} else {
// when none of the conditions are true
}
- comparison operators
a === b
a !== b
- switch statement
switch (conditional value) {
case value1:
//when the conditional value
// is equal to value1
break;
case value2:
//when the conditional value
// is equal to value2
break;
default:
//when the conditional value is not equal
// to value1 or value2
break;
}
- while loop
while (condition) {
// run this code
}
- for loop
for (variable; condition; update) {
// run this code
}
- arrays
~ = [~, ~, ~]
arrayName[indexNum];
arrayName[indexNum] = ~;
arrayName.length
- objects
~~ = {property1: value1, property2: value2}
~~ = {
property1: value1,
property2: value2,
property2: [value1, value2, value3]
};
objectName.propertyName;
objectName.propertyName = ~;
- Arrays in objects
~ = [
{property1: value1, poperty2: value2},
{property1: value3, poperty2: value4}
];
arrayName[indexNumber];
arrayName[indexNumber].propertyName;
- nested objects
~~ = {
property1: value1,
property2: value2,
property3: {
property3-1: value3-1,
property3-2: value3-2,
property3-3: value3-3,
},
};
objectName.propertyName3.perpertyName3-1;
- undefined
non-existent property
using if statement, print a speical statement instead of printing undefined in a state
- function
const functionName = function(parameter) {
//run this code
};
// arrow functions
// new feature of ES6
const functionName = (parameter) => {
//run this code
};
functionName(value);
- return value
const functionName = function(parameter) {
return ~~;
};
const variableName = functionName();
- objects and functions
constt constantName = {
propertyName: () => {
//code
}
};
constantName.propertyName();
- class
class ClassName {
}
const constantName = new ClassName();
// assign an ClassName instance
- constructor
// add changes inside the class
constructor(argument, argument, …) {
this.propertyName = value;
}
instance.property;
instance(value, value, …);
- methods
methodName() {
// run this code
}
instanc.methodName();
methodName() {
this.methodName();
}
- inheritance
class subClassName exends supeClassName {
}
- override
super(argument,…);
// required on the 1st line of the subClass constructor
- export
export default className;
// after defining the class, to export the class
import className from "./fileName";
export default value;
import anyName from "./fileName";
// it is fine to change name
- named export
export { valueName, … };
import { valueName, … } from "./fileName";
- relative paths
./
// current directory
../
// move up one level
./~~/~~
../~~/~~
- packages
chalk
chalk.yellow()
chalk.bgCyan(0
readline-sync
readlineSync.quetion(question);
readlineSync.quetionInt(question);
- push
arrayName.push(value);
// you can add a value to the end of the arrayName
- forEach
arrayName.forEach((arguments) => {// code to apply};)
// arrow function one-by-one
- find
arrayName.find((argument) => {
// return condition;
});
// it stops when arguments matching with condition
// unless then, nothing is printed
- filter
arrayName.filter((argument) => {
// return condition;
});
// find every argument which matching with condition
- map
arrayName.map((argument) => {
// return condition;
});
// creates a new array containing the resulting values
- callback function
// the functionName is assigned
const constantName = (parameterName) => {
callback();
};
callbackFunction (functionName);
//pass the functionName as the argument
// there is no () after a functionName
callbackFunction( () => {
// run this code
});
const constantName = (callback) => {
callback(value);
});
constantName(argument) => {
// run this code
});
-
'IT' 카테고리의 다른 글
[제37회 SQL 개발자(SQLD)/독학/합격후기] (0) | 2020.08.13 |
---|---|
JAVA / Progate (0) | 2020.07.27 |
SQL / Progate (0) | 2020.07.22 |
HTML , CSS / Progate (0) | 2020.07.20 |
Python / Progate (0) | 2020.07.17 |