Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

First Scripting Language for Web

Name: Anonymous 2013-09-08 22:37

I want to get off my mind of C and ((Scheme)) for a while and learn a scripting language for the web. My professor asked me if I could do a Javascript job for him and I said, I'd have to learn it first.

I want to learn Javascript or CoffeeScript but since the latter is simply a transcompiler for the other, should I learn Javascript first before getting to Coffeescript? I heard Coffeescript often makes more optimized code than Javascript, what if I just learn Coffeescript and submit the transcompiled code to my professor?

Name: Anonymous 2013-09-10 7:41

>>13
CoffeeScript
fib = (n) ->
(fib_r = (a, b, n) ->
if n <= 0
a
else
fib_r b, a + b, n - 1
) 0, 1, n

console.log fib 14


JavaScript
// Generated by CoffeeScript 1.4.0
(function() {
var fib;

fib = function(n) {
var fib_r;
return (fib_r = function(a, b, n) {
if (n <= 0) {
return a;
} else {
return fib_r(b, a + b, n - 1);
}
})(0, 1, n);
};

console.log(fib(14));

}).call(this);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List