CoffeeScript The Smart Way
Minimum price
Suggested price

CoffeeScript The Smart Way

Learn CoffeeScript by Solving the Most Interesting Scenarios

About the Book

CoffeScript allows you to code with less lines than Javascript, it makes everything easier than Javascript, it's powerful, efficient, it's the language you need to start using from now on.

You write your code in CoffeeScript, then it gets compiled into plain Javascript and it's fully compatible with all your scripts, libraries and frameworks.

The functionality of CoffeScript is incredible, a script coded in Javascript might take you 57 lines of code, when you use CoffeScript you might code the same script in just 13 lines.

People are using CoffeeScript to make games, web development, applications, you name it !! It's easy to learn and this book takes you through a series of scenarios teaching you how to address them in CoffeSccript. (Once you see it in action you will never stop using it !!)

Check out other books from the author:

Javascript Snippets

Up to Speed with Javascript in 59 minutes

Learning Python Programming from Scratch

Appwrite Up and Running

Javascript Challenges

Front End Developer Interview Questions

ReactJS Documentation

Backend Developer Interview Questions

VueJS Documentation

React Redux Documentation


  • Share this book

  • Categories

    • JavaScript
    • Computers and Programming
    • Web Development
  • Feedback

    Email the Author(s)

About the Author

Alejandro Garcia
A.J. García

I started my coding career back in 2003. Lately I've been involved a lot in Javascript for frontend and the backend.

I would love passing along to you some of the experiences and challenges I've faced over the years.

Bundles that include this book

Bought separately
Bundle Price

Table of Contents

  • Other Books by Alejandro
    • Recommended Resources
  • Introduction
    • Who is this book for ?
    • What this book covers ?
  • Chapter 1: Syntax Scenarios
    • Code Reuse on Client and Server
    • Comparing Ranges
    • Embedding JavaScript
    • For Loops
  • Chapter 2: Classes and Objects Scenarios
    • Chaining Calls to an Object
    • Class Methods and Instance Methods
    • Class Variables and Instance Variables
    • Cloning an Object (Deep Copy)
    • Mixins for classes
    • Create an Object Literal if It Does Not Already Exist
    • A CoffeeScript Type Function
  • Chapter 3: Strings Scenarios
    • Capitalizing Words
    • Finding Substrings
    • Generating a Unique ID
    • String Interpolation
    • Lowercasing a String
    • Matching Strings
    • Repeating a String
    • Repeat method for Strings
    • Replacing Sub-Strings Within a String
    • Splitting a String
    • Trimming Whitespace from a String
    • Uppercasing a String
  • Chapter 4: Arrays Scenarios
    • Check if type of value is an Array
    • Concatenating Arrays
    • Creating a dictionary Object from an Array
    • Creating a String from an Array
    • Define Ranges Array
    • Filtering Arrays
    • List Comprehensions
    • Mapping Arrays
    • Max Array Value
    • Reducing Arrays
    • Removing Duplicate Elements from Arrays
    • Reversing Arrays
    • Shuffling Array Elements
    • Testing Every Element
    • Using Arrays to Swap Variables
    • where for arrays of objects
    • Python-like Zip Function
  • Chapter 5: Dates and Times Scenarios
    • Calculate the Date of Easter Sunday
    • Calculate the Date of Thanksgiving (USA and Canada)
    • Get Days Between Two Dates
    • Finding the Last Day of the Month
    • Finding Last (or Next) Month
    • Calculate Phase of the Moon for a Date
  • Chapter 6: Math Scenarios
    • Math Constants
    • Faster Fibonacci Algorithm
    • Fast Inverse Square Root
    • Generating Predictable Random Numbers
    • Generating Random Numbers
    • Converting Radians and Degrees
    • A Random Integer Function
    • Working with Exponents and Logarithms
  • Chapter 7: Functions Scenarios
    • Debounce Functions
    • When Function Parentheses Are Not Optional
    • Recursive Functions
    • Splat Arguments
  • Chapter 8: Metaprogramming Scenarios
    • Detecting and Creating Missing Functions
    • Extending Built-in Objects
  • Chapter 9: jQuery Scenarios
    • AJAX
    • Callback Bindings # using ⇒ instead of ->
    • Create a jQuery Plugin
    • Ajax Request Without jQuery
    • Older Browser Support
  • Chapter 10: Regular Expressions Scenarios
    • Using Heregexes
    • Replacing HTML Tags with HTML Named Entities
    • Replacing Substrings
    • Searching for Substrings
  • Chapter 11: Networking Scenarios
    • Basic Client
    • Basic HTTP Client
    • Basic HTTP Server
    • Basic Server
    • Bi-Directional Client
    • Bi-Directional Server
  • Chapter 12: Design Patterns Scenarios
    • Adapter pattern
    • Bridge Pattern
    • Builder Pattern
    • Command Pattern
    • Decorator Pattern
    • Factory Method Pattern
    • Interpreter Pattern
    • Memento Pattern
    • Observer Pattern
    • Singleton Pattern
    • Strategy Pattern
    • Template Method Pattern
  • Chapter 13: Databases Scenarios
    • MongoDB
    • SQLite
  • Chapter 14: Testing Scenarios
    • Testing with Jasmine
    • <span style=”color: red;”>Running the Tests</span>
    • Getting the Tests to Pass
    • <span style=”color: green;”>Refactoring the Tests</span>
    • Testing with Nodeunit
    • <span style=”color: red;”>Running the Tests</span>
    • <span style=”color: green;”>Getting the Tests to Pass</span>
    • <span style=”color: green;”>Refactoring the Tests</span>
  • Keep developing your CoffeScript skills
  • About the Author

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub