3 ms·
Basic for loops: for(x in 0 ... 5) { // increment by +1 only } More verbose JSON: var t = Json.parse("{ x: 1 }"); var tx = t.x; // ju
by benologist 11y ago
Basic for loops:
for(x in 0 ... 5) {
// increment by +1 only
}
More verbose JSON:
var t = Json.parse("{ x: 1 }");
var tx = t.x; // just might be undefined
// vs working
var tx2 = Reflect.getProperty(t, "x")
Tricky array sorts:
myArr.sort(function(a, b) {
// just might crash
});
// vs stable
haxe.ds.ArraySort.sort(myArr, function(a, b) {
});
More verbose everything:
var v1 = 0;
var v2 = 0;
var v3 = 0;
var v4 = function(a, b) {
// also no 'arguments', that's more verbose too
};
Different syntax for familiar libs (if supported):
https://github.com/andyli/jQueryExternForHaxe
new JQuery("li").hide(); // $("li").hide()
If you're not targeting JS your HTTP requests are probably going to be synchronous and block the main thread.
If your target is only JavaScript / NodeJS you can get a lot of the benefits of Haxe by using TypeScript, with a much larger ecosystem to help you achieve your goals quickly.