What Is CoffeeScript?
CoffeeScript is a very simple, small programming language that compiles into JavaScript.
The main purpose of CoffeeScript is –
ü Write simple and better code
ü More relevant syntax and
ü Avoiding the irregular nature of JavaScript code
CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.
CoffeeScript was designed and developed by Jeremy Ashkenas in Dec, 2009.
Jeremy Ashkenas was inspired by Python, Ruby and Haskell and it adopted syntax and coding styles from them which makes it very useful and unique.
1. Filename extensions- coffee, .litcoffee
2. First appeared- Dec 13, 2009
3. Stable release- 2.0.0 / Sep 18, 2017
4. Designed by- Jeremy Ashkenas
5. Influenced by- Haskell, JavaScript, Perl, Python, Ruby, YAML
6. License- MIT License
The CoffeeScript Latest Version is - 2.2.2
1. Install locally for a project - npm install --save-dev coffeescript
2. Install globally to execute .coffee files - npm install --global coffeescript
What Are the basic rules to remember for CoffeeScript?
The Rules for CoffeeScript is -
1. Whitespace matters
2. No parentheses
What Are the advantages of CoffeeScript over JavaScript?
1. Lots of less code with CoffeeScript rather than JavaScript.
2. Easier to perform with CoffeScript rather than JavaScript
3. Contains lightweight add-ons.
What Are the disadvantages of CoffeeScript?
1. CoffeeScript includes an additional compilation step while compilation - compiles into JavaScript
2. Only limited resources are available for CoffeeScript.
Are there particular types of JavaScript development that would benefit from CoffeeScript?
Myself, I’m used CoffeeScript for web development, game development and others that I want to end up in JavaScript. Regardless of what libraries you are building for, the output of CoffeeScript is JavaScript, so there is nothing that it cannot do.
What's New In CoffeeScript 2?
Major new features in CoffeeScript 2 are -
1. CoffeeScript 2 include async functions
2. CoffeeScript 2 include JSX
3. Support for modern JavaScript syntax
4. CoffeeScript 2 compiler produces modern JavaScript syntax - ES6, or ES2015 and others
What Is the difference between variables in CoffeeScript and JavaScript?
In the JavaScript, you have to add semicolon at the end of statements while in the CoffeeScript no need to add semicolon at the end of the statements.
What Is function in CoffeeScript?
A function in CoffeeScript is an Optional list of parameters followed by an arrow (->), and then the function body.
The example looks like-
// square = (x) -> x * x
// cube = (x) -> square(x) * x
// log = (message) -> console.log message
Why Is CoffeeScript getting popularity day by day?
CoffeeScript is most popular language in GitHub. Currently, it is on 11the place on GitHub and the main purpose is to produce simple, little JavaScript without writing much code.
Reasons behind the popularity -
1. Very Little Coding is required when programming in CoffeeScript as compared to JavaScript.
2. CoffeeScript includes all the good features of JavaScript.
3. You can use any existing JavaScript library seamlessly with CoffeeScript.
0 comments:
Post a Comment