Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize subtraction in javascript

Shulou Source: shulou.com Published: 2022-06-03 10:56:17 10月01日 Update

This article mainly shows you "how to achieve javascript subtraction", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve javascript subtraction" this article.

1. NaN returns the Operand of NaN.

2. Positive infinity minus positive infinity returns NaN, other numbers (including negative infinity) return positive infinity, negative infinity minus infinity returns NaN, and other numbers (including positive infinity) return negative infinity.

3. It is not a number. It is calculated after Number (a) is called.

Example

Var a = "2"; var b = 3var num = Number (a); / / convert a string to a numeric if (isNaN (num)) {/ / conversion may fail, such as if an is not a numeric value. Console.log ('a non-numeric value');} else {/ / conversion is successful and the arithmetic operation can be performed. Console.log (aqb);} this is all the content of the article "how to subtract javascript". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Subtraction content numbers articles learning help success characters strings examples situations operands numeric values easy to understand more organization knowledge arithmetic taping industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information Microsoft Huawei Xiaomi