CoffeeScript demo, coffeescriptdemo
# Coffee-script.js resolution xx. coffee script can be embedded directly in the browser, but it is not recommended to use it in real time, coffee-script.js: http://coffeescript.org/extras/coffee-script.js
# To locally install coffee, compile xx. coffee into xx. js. Command: coffee-c xx. coffee
# VARIABLES
MyVar = 1
# Array
MyArray = [1, 2, 3, 4, 5]
# Object
Leader =
Name: "wj"
Age: 25
Alert (leader. name)
# Function if x = null x default 6
Square = (x = 6)->
X * x
Alert (square (myVar ))
Alert (square ())
# Judgment
# Three-object operation
MyVar = 0 if leader. name = 'wj'
Alert (myVar)
If myVar = 0
MyVar = 1
Else if myVar = 1
MyVar = 2
Else
MyVar = 3
# Traversal
MyVar = myVar + x for x in myArray;
MyVar = myVar + x for x in myArray when x = 5
Alert (myVar)
I used html5 js to create an on-site application for a game. Sina Weibo's javascript Implementation of oauth authentication demo has no wealth.
Games are often found on the google homepage.