This content originally appeared on DEV Community and was authored by Tim Myers
Sometimes switching to a new language or framework doesn't mean that you have to make a vast shift in your thinking. In almost every language the concepts are the same it's just the syntax that people get hung up on.
I've been using JavaScript, (specifically React), daily for like 4 years and I've grown accustomed to the "loosey" nature of JavaScript.
For example,
let disabled = true;
if(disabled){
// you can just do this.
}
You're relying on the fact that disabled
can be either true or falsey. So you don't have to check disabled for null
and undefined
and false
and empty
, etc.
In most languages you have to make those checks explicit.
if (disabled != null && disabled != true && TypeOf(disabled) == bool)
So learning the quirks of your particular language is the real trick. Loops work the same conceptually in almost every language.
Thanks for reading and that's all y'all.
This content originally appeared on DEV Community and was authored by Tim Myers
Tim Myers | Sciencx (2021-04-07T23:03:21+00:00) Sometimes It’s The Details. Retrieved from https://www.scien.cx/2021/04/07/sometimes-its-the-details/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.