英 [æbz]

abbr.acrylonitrile-butadiène-styrène acrylonitrile-butadiène-styrène;absence absence;absorption absorption;absorber (ent) absorption

méthode javascript abs() syntaxe

Fonction : Renvoie la valeur absolue du nombre.

Syntaxe : Math.abs(x)
Paramètres : x Obligatoire. Doit être une valeur numérique.​

Retour : La valeur absolue de x.

méthode javascript abs() exemple

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
//取得正数和负数的绝对值
    document.write(Math.abs(7.25) + "<br />")
    document.write(Math.abs(-7.25) + "<br />")
    document.write(Math.abs(7.25-10))

</script>

</body>
</html>

Exécuter l'instance »

Cliquez sur le bouton « Exécuter l'instance » pour afficher l'instance en ligne