SlideShare ist ein Scribd-Unternehmen logo
1 von 11
By:
Priyanka zope
About CoffeeSCript
• The Golden Rule:
o "Its just JavaScript"
• One-to-One Compilage into
equivalent JavaScript
• Runs as fast or faster than
equivalent JavaScript
The code writing and use process of CoffeeScript is
simple:
Write your code in a .coffee file
Compile it into a .js file
Include the .js file in your web page/s like you
would any other JavaScript file
COMMAND THROUGH
coffee --watch --compile try.coffee
DIRECT IN HTML FILE
<script src="https://jashkenas.github.com/coffee-
script/extras/coffee-script.js"
type="text/javascript"></script>
Variables
Functions
Arrays
Conditional Operator
Switch Statment
Variables
There is no need to declare variable in cofeescript.
For e.g.:
**javascript**
var message;
message=“ready for some cofeescript”
alert(message);
**coffeescript**
message=“ready for some cofeescript”
alert(message)
Function
• White Space Delimiter
o Semicolons ';' are
useless
• Curly braces '{}' are
unnecessary
o Solved with indents or
new lines
• Functions
o () contains parameter
list
o -> points to the body
Array
Arrays can use whitespace instead of comma separators,
although the square brackets ([]) are still required.
array1 = [1, 2, 3]
array2 = [ 1
2
3
]
Conditional Operators
Existential Operator
• In JS, "if (var)" is close
o Fails on 0, "", and false
• In CoffeeScript
o "?" returns true if null or
undefined
Switch Statements
• Typical Switch has
o Switch cond:
o case 1, break; case 2,
break; ......
• Switch in CoffeeScript
o Switch cond:
 when ... then ... else
o does not require "breaks"
or "default"
Coffee script final

Weitere ähnliche Inhalte

Was ist angesagt?

ClojureScript: I can't believe this is JavaScript
ClojureScript: I can't believe this is JavaScriptClojureScript: I can't believe this is JavaScript
ClojureScript: I can't believe this is JavaScriptEric Normand
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?Weng Wei
 
5 reasons to program javascript
5 reasons to program javascript5 reasons to program javascript
5 reasons to program javascriptMichael Banzon
 
Azkaban-en
Azkaban-enAzkaban-en
Azkaban-enwyukawa
 
A Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-ServiceA Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-ServiceValeri Karpov
 
Db migration automation
Db migration automationDb migration automation
Db migration automationThomas Queste
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHPAurimas Niekis
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails DeploymentAlan Hecht
 
Fastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + SwaggerFastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + SwaggerTony Tam
 
Analyse your web performance
Analyse your web performanceAnalyse your web performance
Analyse your web performanceRon Apelbaum
 
10 tips to make your ASP.NET Apps Faster
10 tips to make your ASP.NET Apps Faster10 tips to make your ASP.NET Apps Faster
10 tips to make your ASP.NET Apps FasterBrij Mishra
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoWeng Wei
 
Fast Web Applications with Go
Fast Web Applications with Go Fast Web Applications with Go
Fast Web Applications with Go Eylem Ozekin
 
Getting Started with ASP.NET 5
Getting Started with ASP.NET 5Getting Started with ASP.NET 5
Getting Started with ASP.NET 5Brij Mishra
 

Was ist angesagt? (20)

ClojureScript: I can't believe this is JavaScript
ClojureScript: I can't believe this is JavaScriptClojureScript: I can't believe this is JavaScript
ClojureScript: I can't believe this is JavaScript
 
Reason React
Reason ReactReason React
Reason React
 
Async js
Async jsAsync js
Async js
 
Single page App
Single page AppSingle page App
Single page App
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
5 reasons to program javascript
5 reasons to program javascript5 reasons to program javascript
5 reasons to program javascript
 
Serverless by examples and case studies
Serverless by examples and case studiesServerless by examples and case studies
Serverless by examples and case studies
 
Azkaban-en
Azkaban-enAzkaban-en
Azkaban-en
 
A Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-ServiceA Gentle Introduction to Functions-as-a-Service
A Gentle Introduction to Functions-as-a-Service
 
Db migration automation
Db migration automationDb migration automation
Db migration automation
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
 
Real World Rails Deployment
Real World Rails DeploymentReal World Rails Deployment
Real World Rails Deployment
 
Gemboys
GemboysGemboys
Gemboys
 
Fastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + SwaggerFastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + Swagger
 
Analyse your web performance
Analyse your web performanceAnalyse your web performance
Analyse your web performance
 
10 tips to make your ASP.NET Apps Faster
10 tips to make your ASP.NET Apps Faster10 tips to make your ASP.NET Apps Faster
10 tips to make your ASP.NET Apps Faster
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to Go
 
Fast Web Applications with Go
Fast Web Applications with Go Fast Web Applications with Go
Fast Web Applications with Go
 
Swagger demo
Swagger demoSwagger demo
Swagger demo
 
Getting Started with ASP.NET 5
Getting Started with ASP.NET 5Getting Started with ASP.NET 5
Getting Started with ASP.NET 5
 

Andere mochten auch

Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
 
CoffeeScript in 5mins
CoffeeScript in 5minsCoffeeScript in 5mins
CoffeeScript in 5minsMasakuni Kato
 
Ruby Made Simple: Blocks Plus Iterators
Ruby Made Simple: Blocks Plus IteratorsRuby Made Simple: Blocks Plus Iterators
Ruby Made Simple: Blocks Plus IteratorsJohn Schmidt
 
Concurrency & Ruby
Concurrency & RubyConcurrency & Ruby
Concurrency & Rubyrockyjaiswal
 

Andere mochten auch (6)

Coffeescript
CoffeescriptCoffeescript
Coffeescript
 
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and JasmineRails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
Rails-like JavaScript using CoffeeScript, Backbone.js and Jasmine
 
CoffeeScript in 5mins
CoffeeScript in 5minsCoffeeScript in 5mins
CoffeeScript in 5mins
 
Ruby Made Simple: Blocks Plus Iterators
Ruby Made Simple: Blocks Plus IteratorsRuby Made Simple: Blocks Plus Iterators
Ruby Made Simple: Blocks Plus Iterators
 
Coffee Script
Coffee ScriptCoffee Script
Coffee Script
 
Concurrency & Ruby
Concurrency & RubyConcurrency & Ruby
Concurrency & Ruby
 

Ähnlich wie Coffee script final

CoffeeScript the Awesome
CoffeeScript the AwesomeCoffeeScript the Awesome
CoffeeScript the AwesomeJames Hughes
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009Jason Davies
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkESUG
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web AppsTimothy Fisher
 
WT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxWT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxTusharTikia
 
Capybara-Webkit
Capybara-WebkitCapybara-Webkit
Capybara-Webkitbostonrb
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPTGo4Guru
 
Js Automation. npm scripts & Gulp
Js Automation. npm scripts & GulpJs Automation. npm scripts & Gulp
Js Automation. npm scripts & GulpAnton Dosov
 
Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)
Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)
Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)Evan Chan
 
Pump up the JAM with Gatsby
Pump up the JAM with GatsbyPump up the JAM with Gatsby
Pump up the JAM with GatsbyStefan Adolf
 
Building Complex Data Workflows with Cascading on Hadoop
Building Complex Data Workflows with Cascading on HadoopBuilding Complex Data Workflows with Cascading on Hadoop
Building Complex Data Workflows with Cascading on HadoopGagan Agrawal
 
Spark Summit 2014: Spark Job Server Talk
Spark Summit 2014:  Spark Job Server TalkSpark Summit 2014:  Spark Job Server Talk
Spark Summit 2014: Spark Job Server TalkEvan Chan
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewDiacode
 

Ähnlich wie Coffee script final (20)

JavaScript Basics with baby steps
JavaScript Basics with baby stepsJavaScript Basics with baby steps
JavaScript Basics with baby steps
 
Java script
Java scriptJava script
Java script
 
Java script
Java scriptJava script
Java script
 
Coffee script throwdown
Coffee script throwdownCoffee script throwdown
Coffee script throwdown
 
Capistrano
CapistranoCapistrano
Capistrano
 
CoffeeScript the Awesome
CoffeeScript the AwesomeCoffeeScript the Awesome
CoffeeScript the Awesome
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
 
Smooth CoffeeScript
Smooth CoffeeScriptSmooth CoffeeScript
Smooth CoffeeScript
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
WT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxWT Unit-3 PPT.pptx
WT Unit-3 PPT.pptx
 
Capybara-Webkit
Capybara-WebkitCapybara-Webkit
Capybara-Webkit
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
 
Js Automation. npm scripts & Gulp
Js Automation. npm scripts & GulpJs Automation. npm scripts & Gulp
Js Automation. npm scripts & Gulp
 
Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)
Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)
Spark Job Server and Spark as a Query Engine (Spark Meetup 5/14)
 
Pump up the JAM with Gatsby
Pump up the JAM with GatsbyPump up the JAM with Gatsby
Pump up the JAM with Gatsby
 
Building Complex Data Workflows with Cascading on Hadoop
Building Complex Data Workflows with Cascading on HadoopBuilding Complex Data Workflows with Cascading on Hadoop
Building Complex Data Workflows with Cascading on Hadoop
 
Intro to sbt-web
Intro to sbt-webIntro to sbt-web
Intro to sbt-web
 
Spark Summit 2014: Spark Job Server Talk
Spark Summit 2014:  Spark Job Server TalkSpark Summit 2014:  Spark Job Server Talk
Spark Summit 2014: Spark Job Server Talk
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
 

Kürzlich hochgeladen

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Kürzlich hochgeladen (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Coffee script final

  • 2. About CoffeeSCript • The Golden Rule: o "Its just JavaScript" • One-to-One Compilage into equivalent JavaScript • Runs as fast or faster than equivalent JavaScript
  • 3. The code writing and use process of CoffeeScript is simple: Write your code in a .coffee file Compile it into a .js file Include the .js file in your web page/s like you would any other JavaScript file
  • 4. COMMAND THROUGH coffee --watch --compile try.coffee DIRECT IN HTML FILE <script src="https://jashkenas.github.com/coffee- script/extras/coffee-script.js" type="text/javascript"></script>
  • 6. Variables There is no need to declare variable in cofeescript. For e.g.: **javascript** var message; message=“ready for some cofeescript” alert(message); **coffeescript** message=“ready for some cofeescript” alert(message)
  • 7. Function • White Space Delimiter o Semicolons ';' are useless • Curly braces '{}' are unnecessary o Solved with indents or new lines • Functions o () contains parameter list o -> points to the body
  • 8. Array Arrays can use whitespace instead of comma separators, although the square brackets ([]) are still required. array1 = [1, 2, 3] array2 = [ 1 2 3 ]
  • 9. Conditional Operators Existential Operator • In JS, "if (var)" is close o Fails on 0, "", and false • In CoffeeScript o "?" returns true if null or undefined
  • 10. Switch Statements • Typical Switch has o Switch cond: o case 1, break; case 2, break; ...... • Switch in CoffeeScript o Switch cond:  when ... then ... else o does not require "breaks" or "default"