Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
現在JavaScriptを使用している数値とは逆の数値を作成できるかどうかを知りたいです。つまり、数値が400。それを作ることは可能-400ですか、数があれば同様にそれを作る-400ことは可能400ですか?
400
-400
これはjQueryではありません!
それに掛けるだけ-1です。
-1
num = "400" console.log(-num);
コアJS、
function opposite(number) { return(-number); }
http://www.codewars.com/からの短い解決策として
一行で..
const opposite = number => -number;