1. Home
  2. /
  3. Coffeescript
  4. /
  5. Fibonacci Sequence

Fibonacci Sequence - Coffeescript Typing CST Test

Loading…

Fibonacci Sequence — Coffeescript Code

Generates first 10 Fibonacci numbers.

fib = (n) -> if n < 2 then n else fib(n-1) + fib(n-2)
for i in [0..9]
	console.log fib(i)

Coffeescript Language Guide

CoffeeScript is a lightweight, compiled programming language that transcompiles into JavaScript. It aims to enhance JavaScript’s readability and brevity by providing a cleaner syntax, inspired by Ruby and Python, while maintaining full compatibility with existing JavaScript code.

Primary Use Cases

  • ▸Frontend web application scripting
  • ▸Node.js server-side scripts
  • ▸Build tool scripting (Grunt, Gulp, etc.)
  • ▸Rapid prototyping of web apps
  • ▸Transpiling to JavaScript for browser compatibility
  • ▸Integration with JavaScript frameworks like Backbone.js

Notable Features

  • ▸Clean, minimal syntax
  • ▸List comprehensions and destructuring
  • ▸Class-based OOP support
  • ▸Fat arrow functions for lexical this
  • ▸Full interoperability with JavaScript

Origin & Creator

CoffeeScript was created by Jeremy Ashkenas in 2009 to simplify JavaScript development and improve code readability.

Industrial Note

CoffeeScript was widely adopted in web development frameworks, frontend build pipelines, and Node.js projects before the advent of ES6+, serving as a cleaner abstraction over JavaScript for production code.

More Coffeescript Typing Exercises

CoffeeScript Counter and Theme ToggleCoffeeScript Simple AdditionCoffeeScript FactorialCoffeeScript Max of Two NumbersCoffeeScript Array SumCoffeeScript Even Numbers FilterCoffeeScript Conditional Counter IncrementCoffeeScript Resettable CounterCoffeeScript Theme Toggle Only

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher