What is CoffeeScript? Why is everyone talking about? How can it make me a better JavaScript developer? Let's find out together. We will discuss what CoffeeScript is, how it works, and why you should use it. We'll cover the basics of writing CoffeeScript and find out how the => function call is your best friend for writing jQuery AJAX calls. You'll wonder where CoffeeScript has been your whole life. You may also want to buy CoffeeScript dinner and drinks afterwards, but please try to remember it's just a language (but it's flattered anyway).
Presented at jQueryConf Boston 10/2/2011
10. gwt
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* HelloWorld application.
*/
public class Hello implements EntryPoint {
public void onModuleLoad() {
Button b = new Button("Click me", new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Hello World");
}
});
RootPanel.get().add(b);
}
}
11. jsil
using System;
using System.Collections.Generic;
public static class Program {
public static void Main (string[] args) {
var array = new[] { 1, 2, 4, 8, 16 };
foreach (var i in array)
Console.WriteLine(i);
var list = new List<int>(array);
foreach (var j in list)
Console.WriteLine(j);
}
}
12. pyjamas
from pyjamas import Window
from pyjamas.ui import RootPanel, Button
def greet(sender):
Window.alert("Hello, AJAX!")
b = Button("Click me", greet)
RootPanel().add(b)
26. if a
console.log "a is true"
else
console.log "a is false"
unless a
console.log "a is false"
console.log "a is false" unless a
27. if (a) {
console.log("a is true");
} else {
console.log("a is false");
}
if (!a) {
console.log("a is false");
}
if (!a) {
console.log("a is false");
}
28. if a is 'A'
console.log "a is A"
if a == 'A'
console.log "a is A"
29. if (a === 'A') {
console.log("a is A");
}
if (a === 'A') {
console.log("a is A");
}