Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
L I V E S C R I P T
( O R / [ C O F F E E ] | [ L I V E ] S C R I P T / G )
R O C K I N G Y O U R W O R L D . J S
Copyrigh...
J S = F T W & & W T F
Type coercion strangely-ness
[1,2,3] + [5,6,7] = “1,2,35,6,7”
{} + [] = “[object Object]”
{} - [] = NaN
> typeof NaN
> ?
var x = 500
vs.
x = 500
for (x in [3,4,5]) {
console.log(x);
}
for (x in {1:2,3:4}) {
console.log(x);
}
Q U I Z
Which of the following is NOT a usable
javascript keyword:
a. var
b. with
c. in
d. class
e. undefined
JavaScript keywords:
break, case, catch, continue, debugger, default, delete, do, else,
false, finally, for, function, if,...
S P O T T H E B U G !
var car = {
state: "off",
start: function() {
this.state = "starting";
setTimeout(function() {
this....
P R O T O T Y P A L O O S T Y L E
var Person = function(name) {
return {
name: name,
getname: function() {
return this.nam...
null !== undefined
[coffee|live|type]script
A W H I R L A R O U N D C O F F E E
S C R I P T
syntax
scope
variables
functions
templating
list comp.
== vs. ===
lsc ~= coffee + x
F A T T Y G O O D N E S S
fix coffee’s weirdly-ness (like ‘=‘and list comps)
spicy curry and nice
ninja |> <| >> << operat...
LiveScript &lt;| Rocking your world.js
LiveScript &lt;| Rocking your world.js
Upcoming SlideShare
Loading in …5
×

LiveScript &lt;| Rocking your world.js

1,070 views

Published on

Company techsession around LiveScript, and the benefits of langs like Coffee and Live over Javascript directly

Published in: Software, Technology, Sports
  • Be the first to comment

  • Be the first to like this

LiveScript &lt;| Rocking your world.js

  1. 1. L I V E S C R I P T ( O R / [ C O F F E E ] | [ L I V E ] S C R I P T / G ) R O C K I N G Y O U R W O R L D . J S Copyright 2014 - Synthesis Software Technology http://www.synthesis.co.za
  2. 2. J S = F T W & & W T F
  3. 3. Type coercion strangely-ness [1,2,3] + [5,6,7] = “1,2,35,6,7” {} + [] = “[object Object]” {} - [] = NaN
  4. 4. > typeof NaN > ?
  5. 5. var x = 500 vs. x = 500
  6. 6. for (x in [3,4,5]) { console.log(x); }
  7. 7. for (x in {1:2,3:4}) { console.log(x); }
  8. 8. Q U I Z Which of the following is NOT a usable javascript keyword: a. var b. with c. in d. class e. undefined
  9. 9. JavaScript keywords: break, case, catch, continue, debugger, default, delete, do, else, false, finally, for, function, if, in, instanceof, new, null, return, switch, this, throw, true, try, typeof, var, void, while, with. Reserved for future use: abstract, boolean, byte, char, class, const, double, enum, export, extends, final, float, goto, implements, import, int, interface, let, long, native, package, private, protected, public, short, static, super, synchronized, throws, transient, volatile, yield. Reserved for browser: alert, blur, closed, document, focus, frames, history, innerHeight, innerWidth, length, location, navigator, open, outerHeight, outerWidth, parent, screen, screenX, screenY, statusbar, window.
  10. 10. S P O T T H E B U G ! var car = { state: "off", start: function() { this.state = "starting"; setTimeout(function() { this.state = "started" }, 1000); } }; car.start();
  11. 11. P R O T O T Y P A L O O S T Y L E var Person = function(name) { return { name: name, getname: function() { return this.name.toUpperCase(); } } } var peter = new Person("Peter"); peter.getname(); var luke = { name: “Luke” }; luke.getname = peter.getname; luke.getname(); var crazy = peter.getname; crazy(); // ??
  12. 12. null !== undefined
  13. 13. [coffee|live|type]script
  14. 14. A W H I R L A R O U N D C O F F E E S C R I P T syntax scope variables functions templating list comp. == vs. ===
  15. 15. lsc ~= coffee + x
  16. 16. F A T T Y G O O D N E S S fix coffee’s weirdly-ness (like ‘=‘and list comps) spicy curry and nice ninja |> <| >> << operators async backcalls A N D B A T T E R I E S ! prelude more scary compiled js could be a gateway drug… >:-0 D O W N S I D E S O V E R C O F F E E ?

×