CoffeeScript » Introduction


What is CoffeeScript?

CoffeeScript is simply a different way of writing JavaScript. It has a clearer syntax (fewer braces, semicolons, etc.) so there’s less code to write. It smooths out some of JavaScript’s rougher edges and is easier to read and understand.

As it says on CoffeeScript’s website:

CoffeeScript is a little language that compiles into JavaScript.

You can do all the same things in CoffeeScript as in JavaScript because it compiles into JavaScript.

In Framer, you write in CoffeeScript, but your code gets translated on the fly into JavaScript, and then that JavaScript code gets executed.

Interesting… But why would you want to learn CoffeeScript, or JavaScript for that matter?

Well, JavaScript is the only language that can be used in web browsers. The web is a popular platform, so that’s a useful skill to have. You can create complete web applications in CoffeeScript.

Python and Ruby provided the inspiration for CoffeeScript’s clean syntax, so these languages will look familiar if you try them.

Almost all programming languages have the same set of basic concepts, things like variables, if-then-else statements, arrays, objects, methods, and functions. Things that we’ll explore in the next pages.

Just the basics

We’re not going to learn all of CoffeeScript, only what’s needed for building prototypes in Framer. This part of the book will explain the language, with plenty of code examples for you to try (and tweak). You’ll then pick up how to use everything in practice in the upcoming parts of the book.