const arr = [1,2,3]
console.log(Array.isArray(arr))
function formatDate(targetDate){
const [date] = targetDate.toISOString().split("T");
const [year, momth, day] = date.split("-");
return `${year}λ
${month}μ ${day}μΌ`
}
funtion head(arr){
return arr[0] ?? ""
}
μλ°μ€ν¬λ¦½μ λ°°μ΄μ κ°μ²΄ like λ Έλ리μ€νΈ, arguments
const arrayLikeObject = {
0: "Hello",
1: "World".
length: 2
}
Array.isArray
Array.from
const sufficWon = price => price + "μ";
const isOverOneThousand = price => Number(price) > 1000
const ansendingList = (a,b) => a-b;
//function getWonPrice(priceList){
const isOverList = priceList.filter(isOverOneThousand);
const sortList = isOverList.sort(ascendingList);
return sortList.map(suffixWon);
}//
function getWonPrice(priceList){
return priceList
.filter(isOverOneThousand)
.sort(ascendingList)
.map(suffixWon);
}
Array.prototype.every() AND
Array.prototype.some() OR
Array.prototype.find()
Array.prototype.findIndex()
function getUserType(type){
const USER_TYPE={
ADMIN:"κ΄λ¦¬μ",
INSTRUCTOR:"κ°μ¬",
STUDENT:"νμ"
}
return USER_TYPE[type]|| "ν΄λΉμμ"
}
function getUserType(type){
return(
{
ADMIN: "κ΄λ¦¬μ",
INSTRUCTOR :"κ°μ¬",
STUDENT:"μκ°μ",
}[type] ?? "ν΄λΉμμ"
)
}
function Person(name, {age, location}){
this.name = name;
this.age = age;
this.location = location;
}
const pocoOptions = {
age: 30,
location: "Korea"
}
const poco = new Person("poco", pocoOptions)
const orders = ["first", "second", "third"];
const {0: st2, 2: rd2} = orders;
console.log(st2);
console.log(rd2);
or
const [st2, ,rd3] = orders;
Object.isFrozen(STATUS)
Object.keys
Object.values
Object.entries