substraction js

Solutions on MaxInterview for substraction js by the best coders in the world

showing results for - "substraction js"
Steven
24 Apr 2018
1// Sometimes we need to substract values from a form. 
2// Those come in as strings. So we need to convert them first. 
3// We can do this with Number(). 
4var c = Number($_POST['a']) - Number($_POST['b']); 
5// or 
6var c = Number($_GET['a']) - Number($_GET['b']);
7// or FLOAT 
8var c = Number.parseFloat($_POST['a']) - Number.parseFloat($_POST['b']); 
9// or 
10var c = Number.parseFloat($_GET['a']) - Number.parseFloat($_GET['b']);
11// or INTEGER 
12var c = Number.parseInteger($_POST['a']) - Number.parseInteger($_POST['b']); 
13// or 
14var c = Number.parseInteger($_GET['a']) - Number.parseInteger($_GET['b']);
similar questions
queries leading to this page
substraction js