Coffee script final
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
268
On Slideshare
268
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. By: Priyanka zope
  • 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>
  • 5. Variables Functions Arrays Conditional Operator Switch Statment
  • 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"