Answers for "substraction js"

0

substraction js

// Sometimes we need to substract values from a form. 
// Those come in as strings. So we need to convert them first. 
// We can do this with Number(). 
var c = Number($_POST['a']) - Number($_POST['b']); 
// or 
var c = Number($_GET['a']) - Number($_GET['b']);
// or FLOAT 
var c = Number.parseFloat($_POST['a']) - Number.parseFloat($_POST['b']); 
// or 
var c = Number.parseFloat($_GET['a']) - Number.parseFloat($_GET['b']);
// or INTEGER 
var c = Number.parseInteger($_POST['a']) - Number.parseInteger($_POST['b']); 
// or 
var c = Number.parseInteger($_GET['a']) - Number.parseInteger($_GET['b']);
Posted by: Guest on September-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language