Files
freeCodeCamp/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/create-decimal-numbers-with-javascript.md
2022-09-07 14:34:53 +02:00

1.2 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
cf1391c1c11feddfaeb4bdef 創建一個小數 1 https://scrimba.com/c/ca8GEuW 16826 create-decimal-numbers-with-javascript

--description--

我們也可以把小數存儲到變量中。 小數有時候也被稱作浮點數或者 floats

注意: 當你計算數字時,它們是以有限的精確度計算的。 使用浮點數的運算可能產生不同於預期結果的結果。 如果你生成了一個非預期的結果,請在 freeCodeCamp 論壇上創建一個話題進行說明。

--instructions--

創建一個變量 myDecimal,並給它賦值一個浮點數(例如 5.7)。

--hints--

myDecimal 應該是一個數字。

assert(typeof myDecimal === 'number');

myDecimal 應該包含小數點。

assert(myDecimal % 1 != 0);

--seed--

--after-user-code--

(function(){if(typeof myDecimal !== "undefined"){return myDecimal;}})();

--seed-contents--

const ourDecimal = 5.7;

// Only change code below this line

--solutions--

const myDecimal = 9.9;