본문 바로가기

웹 스터디16

[JavaScript] Array APIs 총정리!! By.Quiz (With. Ellie) // Q1. make a string out of an array { const fruits = ['apple', 'banana', 'orange']; const result = fruits.join(); console.log(result); } // 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]; const result = array.reverse(); console.log(res.. 2021. 8. 15.
[JavaScript] Array 개념 총정리! ( With. Ellie ) Array🎉 1. Declaration new 사용 or [] 사용 const arr1 = new Array(); const arr2 = [1, 2]; 2. Index position const fruits = ['🍎', '🍌']; console.log(fruits); //배열 정보 출력 console.log(fruits.length); // 배열 크기 출력 console.log(fruits[0]); //0번재 값 출력 console.log(fruits[1]); // 1번재 값 출력 console.log(fruits[2]); //2번째 값 출력 console.log(fruits[fruits.length - 1]); //마지막 위치의 값 출력 (fruits.length === 2) console.clear.. 2021. 8. 1.
[JavaScript] 편리한 Object의 세계! (With. Ellie) 1. Objects one of the JavaScript's data types. a collection of related data and/or functionality. Nearly all objects in JavaScript are instances of Object object = { key : value }; 변수안에 인자를 지정함으로써 좀 더 관리, 활용하기 편리하게 도와준다. const obj1 = {}; // 'object literal' syntax const obj2 = new Object(); // 'object constructor' syntax function print(person) { console.log(person.name); // 인자에 접근시 점(.) 사용! cons.. 2021. 7. 27.
[JavaScript] Class vs Object, 객체지향 언어 클래스 정리 (With. Ellie) class : template ,틀 object : instance of a class JavaScript classes - 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 rotoma = new Person('rotoma', 20); console.log(rotoma.name).. 2021. 7. 27.
[JavaScript] Arrow Fuction이란? 함수의 선언과 표현 (With. Ellie) 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 obje.. 2021. 7. 27.
[JavaScript] 연산, 반복문 operator, if, for loop (With. Ellie) 1) String concatenation -> 문자열 + 문자열 console.log('my'+ 'cat'); console.log('1'+2); console.log(`string literals: 1 + 2 = ${1+2}`); string literals의 좋은점! 줄바꿈을 하거나 특수기호를 넣어도 그대로 문자열로 변환된다. 2) Numeric operators console.log(1 + 1); // add console.log(1 - 1); // substract console.log(1 / 1); // divide console.log(1 * 1); // multiply console.log(1 % 1); // remainder console.log(1 ** 1); // exponentiat.. 2021. 7. 23.