javascript 입문^^

한가연·2021년 7월 19일
0

javascript를 시작했다. 강의 쌤이 java랑 js는 전혀 관련이 없다고 했는데 기초 문법이 비슷해서 java를 다시 배우는 느낌적인 느낌 ㅋㅋㅋㅋ

What I learned:

1. List
리스트를 선언할땐 []를 쓴다

// declaring and intializing
let a_list = [1,2, 'hey', 3]
// outputting index 1
a_list[1] //2을 출력
// adding new index to list
a_list.push('오랜만')
// outputting list
a_list //[1,2, 'hey', 3, '오랜만']을 출력

2. Dictionary
Dictionary는 key와 value 값을 묶은 것이다. Dictionary를 선언할 때 {}를 쓴다

// declaring and initializing
let a_dict = {'name':'Bob','age':21}
// outputting the value of the key 'name'
a_dict['name'] // 'Bob'을 출력
// outputting the value of the key 'age'
b_dict['age'] // 21을 출력
// adding a new key and value
b_dict['height'] = 180
// outputting dictionary
b_dict // {name: "Bob", age: 21, height: 180}을 출력

함수, 조건문, 반복문들은 java랑 거의 비슷하기 때문에 js를 다루는데
큰 어려움이 없을것 같아서 다행이다 ㅎㅎ
이제 숙제하러 가즈아!!

profile
코딩하는 드라마러버

0개의 댓글