freeCodeCamp/curriculum/challenges/chinese-traditional/02-javascript-algorithms-an.../basic-javascript/create-decimal-numbers-with...

1.1 KiB

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

--description--

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

提示: 不是所有的實數都可以用浮點數(floating point)來表示。 因爲可能產生四捨五入的錯誤, 點擊這裏瞭解細節

--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;