SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Db migration automation
Db migration automationDb migration automation
Db migration automation
Thomas Queste
 

Tendances (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
 

En vedette (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
 

Similaire à Coffee script final

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
ESUG
 
Capybara-Webkit
Capybara-WebkitCapybara-Webkit
Capybara-Webkit
bostonrb
 
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
Evan Chan
 

Similaire à 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
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

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"