Front-end/Vanilla JS
ellie: JSON
philo0407
2020. 11. 11. 21:33

let swCho = {
name : 'swCho',
age : 28,
likes : {
computer : 'js, java, web, algorithms',
respects : 'feyman, Jaeseung Jeong, egoing ..',
movie : 'The Spiriting Away Of Sen And Chihiro'
}
}
도랏..
https://www.youtube.com/watch?v=FN_D4Ihs3LE&list=PLv2d7VI9OotTVOL4QmPfvJWPJvkmv6h-2&index=10
엘리쨩 감사합니다 !
sample Data
let swCho = {
name : 'swCho',
age : 28,
likes : {
computer : 'js, java, web, algorithms',
respects : 'feyman, Jaeseung Jeong, egoing ..',
movie : 'The Spiriting Away Of Sen And Chihiro'
}
}
// Object to JSON
// stringify(obj)
let json = JSON.stringify();
json = JSON.stringify(true);
console.log(json);
json = JSON.stringify(['apple', 'banana']);
console.log(json);
let swCho = {
name: 'swCho',
beMad: () => console.log("뿌잉뿌잉 ><"),
curAge: (new Date()).getFullYear() - 1993 +1,
toDay: new Date()
//,symbol: Symbol('id')
};
json = JSON.stringify(swCho);
console.log(json);
// js만의 특별한 dataType이나 메서드는 포함이 안댄다
json은 string 타입이야.
// JSON to Object
// parse(json)
console.clear();
json = JSON.stringify(swCho);
let obj = JSON.parse(json);
console.log(obj);
swCho.beMad();
console.log(swCho.toDay.getDate());
역..과정
나머지는 낼~모래 다시 하자...