Truthy And Falsy Value In JavaScript.

truthy-and-falsy-value-in-javascript.

There are two most important terms to understand when you execute some code based on an “if else” statement. Truthy and Falsy value.
Truthy value: Data types that return true by default are called truthy.
False value: Data types that return false by default are called falsy

  • All values are truthy except these values
  • +0 or -0
  • BigInt zero (0n)
  • Empty String (“”)
  • null, undefined, and NaN

For example below this code we are performing a Linear search. But when I apply a condition for “value not found” I have a complexity for array index 0. I solved this in my way. But there are several ways to solve this.

Image description

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
reducing-color-depth-with-react/javascript

Reducing Color Depth with React/JavaScript

Next Post
i-made-an-admin-dashboard-for-react-using-tailwind-css!-use-it-for-free!-️

I made an admin dashboard for React using Tailwind CSS! Use it for free! ⚡️

Related Posts