Web/FrontEnd
[JS] 문자를 숫자로 간단하게 바꾸기
Turtle1000
2021. 12. 19. 18:01
참고링크 : https://262.ecma-international.org/7.0/#sec-unary-plus-operator
ECMAScript® 2016 Language Specification
5.1.1Context-Free Grammars# A context-free grammar consists of a number of productions. Each production has an abstract symbol called a nonterminal as its left-hand side, and a sequence of zero or more nonterminal and terminal symbols as its right-hand sid
262.ecma-international.org
신기한 기능을 봤다. 숫자로된 문자앞에 연산자를 붙이니 숫자가 되어버렸다?!
간단하고 빠르게 결론
console.log(typeof "1")
VM89:1 string
console.log(typeof +"1")
VM98:1 number
console.log(typeof -"1")
VM114:1 number
JS는 공부하면 공부할수록 기능이 너무 다양하다.