DEV Community

Cover image for Sometimes It's The Details
Tim Myers
Tim Myers

Posted on • Edited on

Sometimes It's The Details

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.
}
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)