Is there any tool for javascript that keeps human beings sane? For instance one that hints me that this code
"use strict";
function foo(b) {
console.log(b);
}
foo(3, 4);
calls foo with the wrong number of arguments?
I know about typescript and cljs obviously, but I wonder if something for pure javascript exists?@sveri: the arguments declared says nothing about the amount of arguments you can pass to a function in javascript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/length
@borkdude: is it really that bad?
@sveri: it's a design choice (which I don't understand)
Funny that there is also Function.length which holds the number of parameters the functions expects
still that would leave place to a linter that checks if these two things match
@sveri I'm doing some CoffeeScript atm. In my opinion this language is even worse than JavaScript.
worse? is that possible?
it depends on how you look at it
We had a contractor build us some "JS" stuff and they used CoffeeScript. Told us "It's way better than JS!". Having tried to maintain it for a while, we do not agree!!!
Interesting, might be nice for me to google for Coffeescript critiques.
A while ago, I convinced a (fairly hostile) team to consense on allowing Coffeescript in a Node.js project. (Naturally, I emphasized disadvantages to balance my advocacy.)
Significantly reduced boilerplate of classes & nested callbacks. Though the way it represented datastructures was a step backwards IIRC. (Or was I able to use Javascript notation then for this?) Liked expressing in Coffeescript by default, but Javascript when better.
One advantage is it was fairly simple to convert Coffeescript <-> Javascript, IIRC. (With reasonable amounts of manual polishing.)