Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript null Conversion to Number

// null is 0 when used with number
let result;

result = 4 + null;
console.log(result);  // 4

result = 4 - null;
console.log(result);  // 4
Comment

PREVIOUS NEXT
Code Example
Javascript :: js how to sort array by object value 
Javascript :: selectboxit 
Javascript :: Using the Sanity client without specifying an API version is deprecated 
Javascript :: Sum of Polygon Angles in javascript 
Javascript :: check if alpine js is loaded 
Javascript :: index and id together angularjs 
Javascript :: object assign js 
Javascript :: change css file with js 
Javascript :: javascript latitude longitude to km 
Javascript :: socket io express 
Javascript :: Material-ui cold icon 
Javascript :: Reactjs exemple class component 
Javascript :: convert days to weeks and days javascript typescript 
Javascript :: add pdf in react app 
Javascript :: custom css mui 
Javascript :: Vue Js pass parameters in computed properties 
Javascript :: svelte on destroy 
Javascript :: java script to send email 
Javascript :: javascript most frequent in a list 
Javascript :: html select multiple selected values 
Javascript :: Custom delay function for waitfor puppeteer 
Javascript :: js not not 
Javascript :: reactjs svg SyntaxError: unknown: Namespace tags are not supported by default 
Javascript :: check if class is clicked javascript 
Javascript :: cypress check element has an attribute 
Javascript :: lowest common ancestor leetcode 
Javascript :: sendgrid mail unique args 
Javascript :: transition css with js 
Javascript :: d3.js onclick event 
Javascript :: json.parse 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =