자바스크립트에서의 다양한 표현방법
아래 결과는 모두 123입니다
console.log의 인자로 들어간 값은 모두 123입니다
하나씩 짚어본다면 자바스크립트 문법의 이해에 도움이 될 수 있습니다
Y29uc29sZS5sb2coMTIzKTsKY29uc29sZS5sb2coKCgpID0+IDEyMykoKSk7CmNvbnNvbGUubG9nKHsgYWE6IDEyMyB9LmFhKTsKY29uc29sZS5sb2coeyBhYTogKDEyMykgfS5hYSk7CmNvbnNvbGUubG9nKCh7IGFhOiAxMjMgfSkuYWEpOwpjb25zb2xlLmxvZyhbNCwgNywgNSwgMTIzXVszXSk7CmNvbnNvbGUubG9nKCh7IGFhOiAoMTIzKSB9KS5hYSk7CmNvbnNvbGUubG9nKChbNCwgNywgNSwgMTIzXSlbM10pOwpjb25zb2xlLmxvZyh7IGFhOiAoMTIzKSB9WydhYSddKTsKY29uc29sZS5sb2coeyBhYTogKCkgPT4gMTIzIH0uYWEoKSk7CmNvbnNvbGUubG9nKCgoKSA9PiB7IHJldHVybiAxMjMgfSkoKSk7CmNvbnNvbGUubG9nKCh7IGFhOiAoKSA9PiAxMjMgfSkuYWEoKSk7CmNvbnNvbGUubG9nKHsgYWE6ICgpID0+IDEyMyB9WydhYSddKCkpOwpjb25zb2xlLmxvZygoeyBhYTogKCkgPT4gMTIzIH0pWydhYSddKCkpOwpjb25zb2xlLmxvZygoWzQsIDcsIDUsICgpID0+IDEyM10pWzNdKCkpOwpjb25zb2xlLmxvZyhmdW5jdGlvbiAoKSB7IHJldHVybiAxMjMgfSgpKTsKY29uc29sZS5sb2coKHsgYWE6ICgpID0+ICgxMjMpIH0pWydhYSddKCkpOwpjb25zb2xlLmxvZygoZnVuY3Rpb24gKCkgeyByZXR1cm4gMTIzIH0pKCkpOwpjb25zb2xlLmxvZygoeyBhYTogKDEyMykgfSlbKCgpID0+ICdhYScpKCldKTsKY29uc29sZVsnbG9nJ10oKFs0LCA3LCA1LCAoKSA9PiAoKSA9PiAxMjNdKVszXSgpKCkpOwooKGNvbnNvbGUpKVsnbG9nJ10oKCh7IGFhOiAoKSA9PiAoMTIzKSB9KVsoJ2FhJyldKSgpKTsKKGNvbnNvbGUpLmxvZygoKCgoKCgoKCgoKCh7IGFhOiAoMTIzKSB9KSkpKSkpKSkpKSkpLmFhKTsKY29uc29sZVsoKCkgPT4gJ2xvZycpKCldKCgoeyBhYTogKCkgPT4gKDEyMykgfSlbJ2FhJ10pKCkpOw==
console.log(123);
console.log((() => 123)());
console.log({ aa: 123 }.aa);
console.log({ aa: (123) }.aa);
console.log(({ aa: 123 }).aa);
console.log([4, 7, 5, 123][3]);
console.log(({ aa: (123) }).aa);
console.log(([4, 7, 5, 123])[3]);
console.log({ aa: (123) }['aa']);
console.log({ aa: () => 123 }.aa());
console.log((() => { return 123 })());
console.log(({ aa: () => 123 }).aa());
console.log({ aa: () => 123 }['aa']());
console.log(({ aa: () => 123 })['aa']());
console.log(([4, 7, 5, () => 123])[3]());
console.log(function () { return 123 }());
console.log(({ aa: () => (123) })['aa']());
console.log((function () { return 123 })());
console.log(({ aa: (123) })[(() => 'aa')()]);
console['log'](([4, 7, 5, () => () => 123])[3]()());
((console))['log']((({ aa: () => (123) })[('aa')])());
(console).log((((((((((((({ aa: (123) })))))))))))).aa);
console[(() => 'log')()]((({ aa: () => (123) })['aa'])());