if Actor.hp<30 {
Actro.hp=30; //keeps actor health at 30 hp minimum
}
Michael Ahlers said:There's a lot of good content here about best project and development practices in general. However, this talk is also full of advice that's either poor or impractical, all based on a straw man that type correctness guarantees program correctness. JavaScript is a language I use every day to build large, modular applications, and it's one of my favorites. Many of its features Elliott stresses in this talk are incredibly powerful. But dynamic typing is its greatest weakness, a weakness that allows incorrectness to easily and quietly slip in to large applications. Meanwhile, several modern languages (e.g., Dart, Scala) offer its benefits with all the safeguards of static typing. Developers aiming to achieve mythical 100% test code coverage—which this talk claims is necessary for confidence in type correctness with JavaScript—are effectively (and unproductively) reinventing compiler type checking.
Not sure what you mean by the compiler/engine doesn't complain, because you would get an error that 'Actro' is not defined.But what's that! It doesn't work and compiler/engine doesn't complain! Then after a weeks looking for a cause you see you've misspelled "Actor". Whoops.Code:if Actor.hp<30 { Actro.hp=30; //keeps actor health at 30 hp minimum }
True, and I agree with your general principle. However, in JS you can't define an object property if the object isn't already defined.Nope, in Javascript (as well as in other dynamic languages) the variable is defined the first time it's used.
const Actor = {};
Actor.hp = 29;
if (Actor.hp < 30) {
Actro.hp=30; //keeps actor health at 30 hp minimum
}
It's interesting then, that you posted this thread in the "Learning Javascript" forum if you have no interest in learning Javascript. Did you come here just to tell us that?As far as learning JS goes, thanks but no thanks.
Perhaps he did derail it, or perhaps he was just responding to your previous statements that JS "sucks big time" and "JS scares me" by trying to give you help/resources so that it would scare you less. Either way, doesn't really matter.You can thank @LTN Games for derailing it.
"Microsoft developed typescript, it was made to have first class citizen support in Visual Studio including Intelligence and on-the-fly compiler errors."Rave said:I don't trust anything Microsoft had direct involvement with.
"TypeScript is just a complete superset of JavaScript. All JavaScript code is totally valid TypeScript code."Rave said:As far as learning JS goes