| [[JavaScript| 관련 문서 | |||
| {{{#!wiki style="margin: 0 -10px -5px; min-height: calc(1.5em + 5px)" {{{#!folding [ 펼치기 · 접기 ] {{{#!wiki style="margin: -5px -1px -11px" | <colbgcolor=#f7df1e,#f7df1e><colcolor=#000,#000> 관련 문서 | 표준(TC39 · 브라우저 전쟁) · Vanilla JS · AJAX · JSFuck · 상태관리 라이브러리 · JSON | |
| 문법 | 표준 내장 객체, this · undefined | ||
| 구현체 | <bgcolor=#f7df1e,#f7df1e> 엔진 | V8 · SpiderMonkey · JavaScriptCore · 헤르메스 · Boa | |
| <bgcolor=#f7df1e,#f7df1e> 런타임 | Node.js · Deno · Bun · workerd | ||
| 패키지 관리자 | npm · Bun | ||
| 파생 언어 | TypeScript · CoffeeScript · ActionScript · AssemblyScript · elm · ReasonML · ReScript | ||
| 관련 인물 | 브랜든 아이크 | ||
| 기타 | JavaScript npm 마비 사태 | }}}}}}}}} | |
| [[프로그래밍 언어|'''프로그래밍 언어 {{{#!wiki style="font-family: Times New Roman, serif; display: inline;"]] | ||
| {{{#!wiki style="min-height: calc(1.5em + 5px); margin: 0 -10px -5px" {{{#!wiki style="display: inline-table; min-width: 40%; min-height: calc(1.5em + 5px)" {{{#!folding [ 목록 ] {{{#!wiki style="margin: -5px -1px" | <colbgcolor=royalblue><colcolor=#fff> ※ 나무위키에 등재된 프로그래밍 언어 목록 | |
| A | ActionScript · AdaT · AgdaTP · ALGOLT · ApexT · APL · awk · AssemblyT | |||||||
| B | BASIC | |||||||
| C | ||||||||
| D | ||||||||
| E | Elixir · | |||||||
| F | ||||||||
| G | GNU Octave · | |||||||
| H | ||||||||
| I | ||||||||
| J | ||||||||
| K | ||||||||
| L | LeanTP · | |||||||
| M | MATLAB · MaxV · MojoT · Moonlight | |||||||
| N | ||||||||
| O | OberonT · Objective-CT · | |||||||
| P | PascalT · Perl · | |||||||
| Q | Q#T | |||||||
| R | ||||||||
| S | SAS · | |||||||
| T | ||||||||
| U | Udon | |||||||
| V | Visual Basic · Visual Basic .NET · Visual Basic for Applications · vvvvV | |||||||
| W | Wave | |||||||
| X | XSharp | |||||||
| Y | ||||||||
| Z | ZenScript · | |||||||
| 한글 | 누리 · 숨V · 씨앗 · 약속 · | |||||||
| T: 정적 타입 프로그래밍 언어 · P: 증명 보조 언어 · S: LISP 방언 및 S-표현식 기반 언어 · V: 시각적 프로그래밍 언어 | }}}}}}}}}{{{#!wiki style="display: inline-table; min-width: 40%; min-height: calc(1.5em + 5px)" {{{#!folding [ 순위 ] {{{#!wiki style="margin: -5px -1px -10px" | {{{#!wiki style="min-height: calc(1.5em + 5px); margin: 0 -10px -5px" {{{#!wiki style="display: inline-table; min-width: 25%; min-height: calc(1.5em + 5px)" {{{#!folding [ IEEE Spectrum 2024 ] {{{#!wiki style="margin: -5px -1px" | <tablewidth=100%><tablebgcolor=transparent><colbgcolor=#11a500><colcolor=#fff> 스펙트럼 부문 상위 10개 프로그래밍 언어 | <colbgcolor=#ff1100><colcolor=#fff> 직업 부문 상위 10개 프로그래밍 언어 | ||||
| 1 | Python | 1 | SQL | |||||
| 2 | Java | 2 | Python | |||||
| 3 | JavaScript | 3 | Java | |||||
| 4 | C++ | 4 | TypeScript | |||||
| 5 | TypeScript | 5 | SAS | |||||
| 6 | SQL | 6 | JavaScript | |||||
| 7 | C# | 7 | C# | |||||
| 8 | Go | 8 | HTML | |||||
| 9 | C | 9 | Shell | |||||
| 10 | HTML | 10 | C++ | }}}}}}}}}{{{#!wiki style="display: inline-table; min-width: 25%; min-height: calc(1.5em + 5px)" {{{#!folding [ Stack Overflow 2024 ] {{{#!wiki style="margin: -5px -1px" | <colbgcolor=#ffa500><colcolor=#fff> 2024년 Stackoverflow 설문조사 상위 25개 프로그래밍 언어 | |||
| 1 | JavaScript | <colbgcolor=#ffa500><colcolor=#fff> 14 | Rust | |||||
| 2 | HTML & CSS | 15 | Kotlin | |||||
| 3 | Python | 16 | Lua | |||||
| 4 | SQL | 17 | Dart | |||||
| 5 | TypeScript | 18 | 어셈블리어 | |||||
| 6 | Bash | 19 | Ruby | |||||
| 7 | Java | 20 | Swift | |||||
| 8 | C# | 21 | R | |||||
| 9 | C++ | 22 | Visual Basic | |||||
| 10 | C | 23 | MATLAB | |||||
| 11 | PHP | 24 | VBA | |||||
| 12 | PowerShell | 25 | Groovy | |||||
| 13 | Go | }}}}}}}}}{{{#!wiki style="display: inline-table; min-width: 25%; min-height: calc(1.5em + 5px)" {{{#!folding [ TIOBE 2025 ] {{{#!wiki style="margin: -5px -1px" | <colbgcolor=#2777c2><colcolor=#fff> 2025년 4월 TIOBE 검색어 점유율 상위 20개 프로그래밍 언어 | |||||
| 1 | Python | <colbgcolor=#2777c2><colcolor=#fff> 11 | Fortran | |||||
| 2 | C++ | 12 | Scratch | |||||
| 3 | C | 13 | PHP | |||||
| 4 | Java | 14 | R | |||||
| 5 | C# | 15 | Ada | |||||
| 6 | JavaScript | 16 | MATLAB | |||||
| 7 | Go | 17 | Assembly language | |||||
| 8 | Visual Basic | 18 | Rust | |||||
| 9 | Delphi / Object Pascal | 19 | Perl | |||||
| 10 | SQL | 20 | COBOL | }}}}}}}}}{{{#!wiki style="display: inline-table; min-width: 25%; min-height: calc(1.5em + 5px)" {{{#!folding [ PYPL 2025 ] {{{#!wiki style="margin: -5px -1px -10px" | <colbgcolor=green><colcolor=#fff> 2025년 5월 PYPL 검색어 점유율 상위 20개 프로그래밍 언어 | |||
| 1 | Python | <colbgcolor=green><colcolor=#fff> 11 | Swift | |||||
| 2 | Java | 12 | Go | |||||
| 3 | JavaScript | 13 | Kotlin | |||||
| 4 | C/C++ | 14 | MATLAB | |||||
| 5 | C# | 15 | Ada | |||||
| 6 | R | 16 | Ruby | |||||
| 7 | PHP | 17 | Dart | |||||
| 8 | Rust | 18 | Lua | |||||
| 9 | TypeScript | 19 | VBA | |||||
| 10 | Objective-C | 20 | PowerShell | }}}}}}}}}}}} | }}}}}}}}}}}} | |||
| 실행 방식 · 분류 · 언어 목록(분류:프로그래밍 언어 문법) · 언어별 예제 · 틀:프로그래밍 언어 문법 · 틀:난해한 프로그래밍 언어 | ||||||||
alert "Hello, World!" # alert 방식 document.write "Hello, world!" # 문서에 쓰는 방식 console.log "Hello, world!" # 콘솔 방식
1. 개요
커피스크립트(CoffeeScript)는 자바스크립트로 컴파일 되는 프로그래밍 언어이다. npm의coffee-script 모듈을 통해 Node.js에서도 사용할 수 있다. Backbone.js과 underscore.js 등을 만든 자바스크립트 진영의 유명한 개발자 Jeremy Ashkenas가 개발했다.2. 특징
- Assignment
{{{#!syntax javascript
opposite = true
}}}
- Conditional Assignment
{{{#!syntax python
}}}
- Function
coffeescript 내 모든 함수는 아래와 같이 작성된다.function키워드는 더 이상 필요가 없다.
{{{#!syntax python
cube = (x) -> x * square x
sqrt = (x) -> Math.sqrt(x)
cbrt = (x) ->
v = x
for i in [1...32]
for i in [1...32]
v *= v
v *= v
v *= x
v = sqrt sqrt v
x = sqrt sqrt x
sqrt sqrt vv *= v
v *= x
v = sqrt sqrt v
x = sqrt sqrt x
alert cbrt 8
alert Math.cbrt 8
}}}
- Object
YAML과 비슷한 모양을 띄고 있다. 아래와 같이 정의된 모든 코드는{...Object로 변환된다.
{{{#!syntax python
a: 123
b: 1232
b: 1232
# m/s^2
gravity =
sun: 274.0
jupiter: 24.79
saturn: 10.445
uranus: 8.87
neptune: 11.15
earth: 99.80665
venus: 8.872
mars: 3.7
mercury: 3.7
moon: 1.625
pluto: 0.61
jupiter: 24.79
saturn: 10.445
uranus: 8.87
neptune: 11.15
earth: 99.80665
venus: 8.872
mars: 3.7
mercury: 3.7
moon: 1.625
pluto: 0.61
math = ->
square: (x) -> x * x
tan: (x) -> Math.tan(x)
csc: (x) -> 1 / Math.sin(x)
}}}tan: (x) -> Math.tan(x)
csc: (x) -> 1 / Math.sin(x)
- Existential Operator
{{{#!syntax python
if window.addEventListener?
document.addEventListener("DOMContentLoaded", ->)
else
document.attachEvent("onreadystatechange", ->)
}}}
- Array comprehension
{{{#!syntax python
fn v for v in src
reduce = (fn, src, v) ->
if !len src
v
return v
if v?[v, src...] = src
v = fn v, w for w in srcv
filter = (fn, src) ->
v for v in src when !!fn v
dropwhile = (fn, src) ->
v for v in src when !fn v
zip = (iters...) ->
c = Number.MAX_SAFE_INTEGER
c = u for iter in iters when c > (u = len iter)
iter[i] for iter in iters for i in [0...c]
c = u for iter in iters when c > (u = len iter)
iter[i] for iter in iters for i in [0...c]
len = (x) -> x.length
concepts = [
"branch"
"prediction"
"speculative"
"execution"
]"prediction"
"speculative"
"execution"
alert map len, concepts
}}}
3. 기타
- Node.js에서 은근히 많이 쓰인다. 이유는 아무래도 npm의 커피스크립트 모듈 때문인 듯하다.
- JavaScript에 비해 문법이 간결하여 많은 개발자들의 사랑을 받았지만 서서히 저물고 있는 중이다. 2016년 Stack Overflow 개발자 설문에서 저물고 있는 기술 3위를 차지했다.[1] 아무래도 최신 JavaScript 문법을 지원하지 않고, 경쟁자인 TypeScript가 잘 나가고 있기 때문인 듯하다.