Skip to content Skip to sidebar Skip to footer

Eslint Error No-unneeded-ternary

ESLint is telling me this error message inside my JS module: error no-unneeded-ternary Unnecessary use of conditional expression for default assignment The error comes in the get

Solution 1:

You don't need a ternary when a simple val || defaultVal will do.

Solution 2:

// Badfoo(bar ? bar : 1);

// Goodfoo(bar || 1);

This is how they say in Es-lint

Post a Comment for "Eslint Error No-unneeded-ternary"