CoffeeScript in 100 Seconds
Coder Gautam
CoffeeScript in 100 Seconds, by Coder Gautam.
Topics Covered:
What is CoffeeScript?
Is CoffeeScript worth learning?
What does CoffeeScript do?
Getting started with CoffeeScript
How to use CoffeeScript
Compiling CoffeeScript
Does CoffeeScript have a future?
You’ve probably heard of Javascript. You’ve probably heard of TypeScript. But have you heard of CoffeeScript?
CoffeeScript is a language that compiles into Normal JavaScript. It adds nice little features on top of JavaScript, inspired by other languages like Ruby, Python, and Haskell that makes code readable and easier to write.
In CoffeeScript, the if, switch, and for expressions return a value. This means you can get rid of unnecessary braces and parentheses, and you can do more things with less code, which is what every programmer wants. There are also additional keywords, like “when”, which allow you to perform linear searches on a single line!
To get started with coffeescript, first install the compiler from npm. Now, we can create a coffeescript file with the .coffee extension. Now, let's create a simple script that cubes an array of numbers. We can create functions with a clean arrow syntax. We can create objects with indentation, similar to YAML. We can run a for loop on a single line. and, we can also use a space instead of parenthesis.
Now, we can use the coffee command to run the script. If you want to compile the coffee file to a javascript file, we can run coffee with the compile switch. This will generate a javascript file with coffee syntax converted to normal javascript syntax.
#coffeescript #javascript #coding ... https://www.youtube.com/watch?v=M7T-RPsd06w
7085382 Bytes