1) What is CoffeeScript?
It is a language that compiles into JavaScript. CoffeeScript is an attempt to expose good parts of JavaScript so, that user can code more easily.
2) Name the founder of CoffeeScript.
Jeremy Ashkenas founded in December, 2009. He also founded BackboneJS and UnderscoreJS.
3) List the languages CoffeeScript is inspired from ?
Three languages has most impact on CoffeeScript
4) Write the basic rules for CoffeeScript Language?
It follows two rules
1. Indentation rule :
- No Parenthesis
- Short Function declaration
- Define Character per line limit
2. Whitespace rule: CoffeeScript is very sensitive towards white space also no curly braces are allowed in script.
5) Enlist the advantage of CoffeeScript over JavaScript.
- Write less do more in CoffeeScript than JavaScript.
- It has very light weight add-ons such as Ruby string Interpolation.
- It compiles to JavaScript Code.
6) Give the syntax difference of variable in CoffeeScript and JavaScript.
In CoffeeScript no keyword should be given to variable such as 'var' in JavaScript. Also, no semi-colon at end of statement.
7) Enlist the disadvantage of CoffeeScript.
- Very less resources available for CoffeeScript Language.
- It has additional step for compilation.
8) How can we convert CoffeeScript code in JavaScript?
We can convert it through the use of Transpilers which translate or convert the CoffeeScript code to JavaScript.
9) Describe Splat in CoffeeScript?
We use Splat term for the (...) operator for the var-argument. This argument can come either before, after or between arguments.
10) Explain Class method in CoffeeScript.
The objects created of a class are stored in object itself rather than Object Prototype which provides central location to store class-level values.
11) Differentiate between Assignment and Clone Function?
Both the functions are used to copy the object but the main difference is:
- Assignment function only copies the reference of Object.
- Clone Function creates a complete new Object.
12) How does Boolean Works in CoffeeScript?
JavaScript has "True or False" for Boolean but CoffeeScript has "On or Yes and Off or No" for the same.
13) Describe Interpolation of string in CoffeeScript.
Syntax is:
- # {...} which is same as Ruby
14) Describe mapping of an array in CoffeeScript.
By using map() function we can map an array in object. We can also use List Mapping for simple mapping as CoffeeScript directly supports it.
15) What is the use of Existential Operator?
- To validate Existence of Variable.
- For function chaining.
- To use conditional assignment.
16) How compiler is helpful in CoffeeScript?
CoffeeScript compiler ensure that within lexical scope, all the variable should be properly declared.
17) What are the different type of loop in CoffeeScript?
CoffeeScript provide two types of loop:
- One for iterating over an array.
- One for iterating over the properties of an object.
18) What is the use of CoffeeScript chained comparison syntax?
CoffeeScript chained comparison syntax is used to know whether any given variable falls inside a given range. It also enables to chain the two comparisons together in a form that matches closely.
19) How Clone Function is useful?
Clone function is useful in creating completly new object by:
- Creating a new object as the source object.
- Copying all attributes from the source object to the new object.
20) Describe the use of destructing assignment.
In CoffeeScript destructing assignment is used to swap the variables by using array.
21) How you can detect and create missing function in CoffeeScript?
In CoffeeScript to etect and create missing function we use use the existential assignment operator (?=).
22) Can we bind parameters to properties in CoffeeScript?
Yes, CoffeeScript allows to bind parameters to properties by using the @ shorthand. It also allows to define class function.
23) Can we bind parameters to properties in CoffeeScript?
Yes, CoffeeScript allows to bind parameters to properties by using the @ shorthand. It also allows to define class function.
24) How can you replace a portion of strings with another value?
In CoffeeScript, we use Regular Expression to match and replace a portion of a string with another value.
25) Describe simple build system.
It is similar to Make and Rake but in CoffeeScript known as Cake. It is used for the tasks that build and test the CoffeeScript language.