Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript unary plus and negation operators

/*
  - + Unary Plus [Return Number If Its Not Number]
  - - Unary Negation [Return Number If Its Not Number + Negates It]
  Tests
  - Normal Number
  - String Number
  - String Negative Number
  - String Text
  - Float
  - Hexadecimal Numeral System => 0xFF
  - null
  - false
  - true
*/

console.log(+100);
console.log(+"100");
console.log(+"-100");
console.log(+"Osama");
console.log(+"15.5");
console.log(+0xff);
console.log(+null);
console.log(+false);
console.log(+true);

console.log(-100);
console.log(-"100");
console.log(-"-100");
console.log(-"Osama");
console.log(-"15.5");
console.log(-0xff);
console.log(-null);
console.log(-false);
console.log(-true);

console.log(Number("100"));
Comment

PREVIOUS NEXT
Code Example
Javascript :: get difference of minutes between two time based on am, pm 
Javascript :: Recorrer Array con forEach 
Javascript :: node js mysql variables 
Javascript :: flutter local json storage 
Javascript :: environment texture in three.js 
Javascript :: stop jboss from cli 
Javascript :: comparare due array di numeri javascript 
Javascript :: open link in a new tab progmatically 
Javascript :: JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. 
Javascript :: javascript div hover alert 
Javascript :: mern heroku Error: ENOENT: no such file or directory 
Javascript :: private methods js 
Javascript :: jquery selector input name regex 
Javascript :: jquery rename id 
Javascript :: kendo js add one day to a date 
Javascript :: send a message discordjs 
Javascript :: filter the falsy values out of an array in a very simple way! 
Javascript :: add fraction in angular 
Javascript :: jquery onchage html content 
Javascript :: geolocation 
Javascript :: jquery deparam 
Javascript :: Find item from objects 
Javascript :: reactjs import electron 
Javascript :: ng-lazyload-image 
Javascript :: How to make PWAs installable js 
Javascript :: Connect node.js with react.js 
Javascript :: when click play sound 
Javascript :: javascript 
Javascript :: javascript check string empty 
Javascript :: how to copy all elements in an array except for the first one in javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =