4 ms·
>It's not technically inferior. Come on. It has plenty of unique problems with no upsides. If that's not inferior, I don't know what is.
by vesak 10y ago
>It's not technically inferior.
Come on. It has plenty of unique problems with no upsides. If that's not inferior, I don't know what is.
- krisdol 10y agoNo upsides compared to what? Faster development time compared to Java, C-family languages is an upside. Faster VM (V8) than Ruby MRI, and just about every other dynamic scripting language, is also an upside. It's also an incredibly easy language to learn and write. Many of the weird inherent flaws went away with strict mode and ES5, ES2015 has helped make it much more elegant to read. Of course, you can always switch to a superior language like Elm that benefits from the same VM.
- vesak 10y agoOh, I did not mean to say that Javascript has no upsides whatsoever. It clearly does. I meant to say that it has problems which have no upsides. By which I mean that it has certain weaknesses that contribute nothing to its good features and that could have been designed correctly without negatively impacting anything. They are just plain mistakes.
- oceanswave 10y agoThe unique problem you mention I think is vocal commenters that see "JavaScript" and immediately take a one-sided mentality against any tech stack that uses it.
- Longwelwind 10y agoTry to work with Javascript's arrays, it's a nightmare. Fun fact: let list = new Array(5); list.forEach(() => { console.log("foo"); }) Will display nothing, if you want to properly initialize an array with a defined length, you have to do: let list = Array.apply(null, Array(5)).map(function () {}) I make web games in Typescript, and I get all sorts of problems like this everytime I have to work with 2D arrays, problems that I don't get when I do games in C# with Unity. Unity's modified Javascript actually implements better arrays and recommends not using Javascript's native arrays: http://docs.unity3d.com/ScriptReference/Array.html http://docs.unity3d.com/ScriptReference/Array.html
- WorldMaker 10y agoYou seem to be trying to fit a square peg into a star-shaped hole. Arrays in JS are actually misnamed, they are actually Lists. For game scripting you may want to make heavy use of Typed Arrays [1], which are more like the arrays you seem to be looking for. [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Type...
- oceanswave 10y agoso use the more common for(let v of list) { console.log("foo"); } If you're saying that "initialize an array with a defined length" should be "initialize an empty array of 5 values of undefined" then yeah, but you can also use: let list = Array.from(Array(5)); as new Array(5) creates an array of length 5, but each is a "hole" I know the syntax is similar to C# or other languages, but because it's slightly different doesn't mean it doesn't bring anything to the table. JS or TS != C# in a browser the syntax is similar...
- krisdol 10y agofor loops will yield better performance and the result you want to get. If you're trying to log 5 times you shouldn't be wasting memory with allocating an array or needlessly calling the forEach function or needlessly creating a callback. You're just wasting garbage collection and cpu time with this