JS 변수에서 $나 _를 왜 쓰는걸까?

2023. 7. 30. 19:57Layover

참고로 나는 제이쿼리를 모른다. 근데 종종 강의나 유튜브를 보면 변수에 $나 _를 쓰는 경우를 심심치 않게 볼 수 있다. 

한국어로 찾으니 getElementById 축약이라고 보통 이야기하는데 내가 봤을 때 이런 경우를 찾는 것 같지는 않았다. 그래서 영문으로 찾아보았다. 

Why JavaScript Variable Starts with a Dollar Sign??

 

https://stackoverflow.com/questions/205853/why-would-a-javascript-variable-start-with-a-dollar-sign

https://www.geeksforgeeks.org/why-javascript-variable-starts-with-a-dollar-sign/

 

Why JavaScript Variable Starts with a Dollar Sign ? - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org

 

여러 글이 있지만... 결론은 그냥 유니크한 변수임을 나타내기 위해서 사용하는 듯하다....