Write, Run & Share CoffeeScript code online using OneCompiler’s CoffeeScript online compiler for free. It’s a sleek and efficient environment to explore CoffeeScript's syntax and compile it directly into JavaScript.
CoffeeScript is a lightweight language that compiles into JavaScript. It introduces a more readable and expressive syntax by eliminating much of the boilerplate found in traditional JavaScript. CoffeeScript supports all JavaScript features but with a more concise syntax.
The following CoffeeScript program prints a greeting:
console.log 'Hello, OneCompiler!'
CoffeeScript itself doesn't support native input, but in environments like OneCompiler, you can simulate input using readline-sync or predefined variables.
readline = require 'readline-sync' name = readline.question 'Enter your name: ' console.log "Hello, #{name}!"
name = 'OneCompiler' age = 25
if age >= 18 console.log 'Adult' else console.log 'Minor'
for i in [1..5] console.log i
i = 1 while i <= 5 console.log i i++
square = (x) -> x * x console.log square 4
fruits = ['apple', 'banana', 'cherry'] person = name: 'Alice', age: 30
This guide provides a quick reference to CoffeeScript syntax and features. Start writing CoffeeScript code using OneCompiler’s CoffeeScript online compiler today!