← Back to challenges

A Simple Task

JavaScriptHardmathnumbers

Instructions

Mubashir needs your help in a simple task.

Create a function that takes a number n and return its decimal part.

Examples

decimalPart(1.2) ➞ 0.2

decimalPart(-3.73) ➞ 0.73

decimalPart(10) ➞ 0
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: YouTube Upload Count