“Substraksi JS” Kode Jawaban

bagaimana melakukan pengurangan dalam javascript

//To subtract in Java script, you have to put an subtraction symbol '-' between them. If you have stored two numbers in variables, just put an subtraction symbol between the variable names.
//For example:
var a = 6
var b = 5
var c = a-b
var d = 6-5

Bot.send (c)/ print (c)// or whatever you use to get output
Bot.send (d)/ print (d)// or whatever you use to get output

//output will be: 1, 1
Your help :P

Substraksi 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']);
freshMan

Jawaban yang mirip dengan “Substraksi JS”

Pertanyaan yang mirip dengan “Substraksi JS”

Lebih banyak jawaban terkait untuk “Substraksi JS” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya