Java๋ ๋น์ทํ ๋ฏ
/*Array (๋ฐฐ์ด)*/
// 1. ๋ฐฐ์ด ์ ์ธ ๋ฐฉ์ 2๊ฐ์ง
// (1) ์ ์ ๋ฐฉ์
weeks = new Array("Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun")
// (2) ๋๊ดํธ ๋ฆฌํฐ๋ด ๋ฐฉ์
weeks =["Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun"]
// 2. ์ถ๋ ฅ
// (1) ๋ฐฐ์ด ์ ์ฒด ์ถ๋ ฅ
console.log(weeks)
// (2) ๋ฐฐ์ด์ ํน์ ์์ ์ถ๋ ฅ
console.log(week[0]) // Mon ์ ์ถ๋ ฅ
// (3) ๋ฐฐ์ด์ ๊ธธ์ด ์ถ๋ ฅ
console.log(week.length)
๋ฐฐ์ด ์ด๋ฆ = [ ] ๋ฐฉ์์ด ๋๊ดํธ ๋ฆฌํฐ๋ด์ด๋ผ ๋ถ๋ฆฌ๋ ์ด์ .
๊ธฐํธ๋ฅผ ์ด์ฉํ์ฌ ๋ฐ์ดํฐ๋ฅผ ๋ง๋๋ ๊ฒ์ ๋ฆฌํฐ๋ด์ด๋ผ ํ๋๋ฐ, ํด๋น ๊ฒฝ์ฐ๋ ๋๊ดํธ๋ฅผ ์ด์ฉํ๊ธฐ ๋๋ฌธ์ด๋ค.
2. ์ค์ค๋ก ํด๋ณด๊ธฐ
weeks = new Array("Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun")
weeks = ["Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun"]
console.log(weeks)
console.log(weeks[4])
console.log(weeks.length)
0