본문 바로가기

프론트앤드 부트캠프/복습

JavaScript koans 복습

728x90

01_Introduction: 자바스크립트의 개요 및 특징에 대한 소개와 함께 자바스크립트의 사용 분야와 역할 등에 대해 설명합니다.

02_Types-part1: 자바스크립트의 데이터 타입에 대해 소개하고, 원시 자료형인 숫자형(Number), 문자열(String), 불린(Boolean), null, undefined, Symbol 등에 대해 자세히 설명합니다.

03_LetConst: 변수 선언 방식 중 let과 const에 대해 다룹니다. let은 블록 스코프를 가지며 값이 변경될 수 있는 변수를 선언할 때 사용하고, const는 값이 변하지 않는 상수를 선언할 때 사용합니다.

04_Scope: 변수의 스코프와 스코프 체인에 대해 다룹니다. 블록 스코프와 함수 스코프, 전역 스코프 등의 스코프 종류와 스코프 체인을 통한 변수 탐색 방법에 대해 설명합니다.

05_ArrowFunction: 화살표 함수(Arrow Function)의 기본 문법과 사용 방법에 대해 다룹니다. 일반 함수와의 차이점과 화살표 함수를 사용할 때 주의할 점 등을 설명합니다.

06_Types-part2: 객체(Object)와 함수(Function)에 대한 자세한 설명과 함께 자바스크립트의 타입 변환(Type Conversion)에 대해 다룹니다.

07_Array: 배열(Array)의 기본 문법과 사용 방법에 대해 설명합니다. 배열의 생성, 추가/삭제, 반복, 정렬 등의 기능과 배열을 다룰 때 유용한 메서드들에 대해 다룹니다.

08_Object: 객체(Object)의 기본 문법과 사용 방법에 대해 설명합니다. 객체의 생성, 속성(Property) 추가/삭제/변경, 메서드(Method) 정의 등을 다루며, 객체를 다룰 때 유용한 내장 메서드들도 다룹니다.

09_SpreadSyntax: 스프레드 문법(Spread Syntax)의 사용 방법과 유용한 활용 예시에 대해 다룹니다. 배열이나 객체를 전개하거나 복사할 때 사용할 수 있으며, 함수 호출 시 인수를 전달할 때 유용하게 사용할 수 있습니다.

10_Destructuring: 객체와 배열에서 필요한 값만 추출할 때 사용하는 디스트럭처링(Destructuring) 문법에 대해 다룹니다. 객체와 배열에서 원하는 값만 추출하는 방법과 함께 중첩된 객체나 배열에서의 추출 방법에 대해 설명합니다.

 


01_Introduction: 자바스크립트의 개요 및 특징에 대한 소개와 함께 자바스크립트의 사용 분야와 역할 등에 대해 설명합니다.

console.log("Hello, World!");



02_Types-part1: 자바스크립트의 데이터 타입에 대해 소개하고, 원시 자료형인 숫자형(Number), 문자열(String), 불린(Boolean), null, undefined, Symbol 등에 대해 자세히 설명합니다.

let myNumber = 10;
let myString = "Hello";
let myBoolean = true;
let myNull = null;
let myUndefined = undefined;

console.log(typeof myNumber); // "number"
console.log(typeof myString); // "string"
console.log(typeof myBoolean); // "boolean"
console.log(typeof myNull); // "object" (this is a bug in JavaScript)
console.log(typeof myUndefined); // "undefined"



03_LetConst: 변수 선언 방식 중 let과 const에 대해 다룹니다. let은 블록 스코프를 가지며 값이 변경될 수 있는 변수를 선언할 때 사용하고, const는 값이 변하지 않는 상수를 선언할 때 사용합니다.

let myVariable = "initial value";
myVariable = "new value"; // This is allowed with `let`

const myConstant = "initial value";
myConstant = "new value"; // This is not allowed with `const`



04_Scope: 변수의 스코프와 스코프 체인에 대해 다룹니다. 블록 스코프와 함수 스코프, 전역 스코프 등의 스코프 종류와 스코프 체인을 통한 변수 탐색 방법에 대해 설명합니다.

let globalVariable = "I am global";

function myFunction() {
  let localVariable = "I am local";
  console.log(globalVariable); // "I am global"
  console.log(localVariable); // "I am local"
}

myFunction();
console.log(globalVariable); // "I am global"
console.log(localVariable); // ReferenceError: localVariable is not defined


05_ArrowFunction: 화살표 함수(Arrow Function)의 기본 문법과 사용 방법에 대해 다룹니다. 일반 함수와의 차이점과 화살표 함수를 사용할 때 주의할 점 등을 설명합니다.

// Traditional function
function add(a, b) {
  return a + b;
}

// Arrow function
const add = (a, b) => a + b;



06_Types-part2: 객체(Object)와 함수(Function)에 대한 자세한 설명과 함께 자바스크립트의 타입 변환(Type Conversion)에 대해 다룹니다.

// Arrays
let myArray = [1, 2, 3];
console.log(typeof myArray); // "object"

// Objects
let myObject = { key1: "value1", key2: "value2" };
console.log(typeof myObject); // "object"

// Functions
let myFunction = function() { console.log("Hello, World!"); };
console.log(typeof myFunction); // "function"



07_Array: 배열(Array)의 기본 문법과 사용 방법에 대해 설명합니다. 배열의 생성, 추가/삭제, 반복, 정렬 등의 기능과 배열을 다룰 때 유용한 메서드들에 대해 다룹니다.

let myArray = [1, 2, 3];

// Accessing elements
console.log(myArray[0]); // 1
console.log(myArray[1]); // 2
console.log(myArray[2]); // 3

// Modifying elements
myArray[1] = 4;
console.log(myArray); // [1, 4, 3]

// Adding elements
myArray.push(5);
console.log(myArray); // [1, 4, 3, 5]

// Removing elements
myArray.pop();
console.log(myArray); // [1, 4, 3]


08_Object: 객체(Object)의 기본 문법과 사용 방법에 대해 설명합니다. 객체의 생성, 속성(Property) 추가/삭제/변경, 메서드(Method) 정의 등을 다루며, 객체를 다룰 때 유용한 내장 메서드들도 다룹니다.

let myObject = {
  firstName: "John",
  lastName: "Doe",
  age: 30,
  hobbies: ["reading", "swimming"]
};

// Accessing properties
console.log(myObject.firstName); // "John"
console.log(myObject["lastName"]); // "Doe"

// Modifying properties
myObject.age = 35;
console.log(myObject.age); // 35

// Adding properties
myObject.city = "New York";
console.log(myObject.city); // "New York"

// Removing properties
delete myObject.age;
console.log(myObject.age); // undefined


09_SpreadSyntax: 스프레드 문법(Spread Syntax)의 사용 방법과 유용한 활용 예시에 대해 다룹니다. 배열이나 객체를 전개하거나 복사할 때 사용할 수 있으며, 함수 호출 시 인수를 전달할 때 유용하게 사용할 수 있습니다.

let myArray1 = [1, 2, 3];
let myArray2 = [4, 5, 6];

// Combining arrays
let combinedArray = [...myArray1, ...myArray2];
console.log(combinedArray); // [1, 2, 3, 4, 5, 6]

// Copying arrays
let copyOfArray = [...myArray1];
console.log(copyOf


10_Destructuring: 객체와 배열에서 필요한 값만 추출할 때 사용하는 디스트럭처링(Destructuring) 문법에 대해 다룹니다. 객체와 배열에서 원하는 값만 추출하는 방법과 함께 중첩된 객체나 배열에서의 추출 방법에 대해 설명합니다.

const person = {
  name: 'John',
  age: 30,
  gender: 'male'
};

// 객체에서 변수 추출하기
const { name, age } = person;

console.log(name); // 'John'
console.log(age); // 30

728x90