0

I want this function to take value x and return 00X but it didn't work why please?

https://code.sololearn.com/WSAOXoGvzu29/?ref=app

29th Dec 2020, 2:13 PM
Abbakar_ah!!!
Abbakar_ah!!! - avatar
3 odpowiedzi
+ 2
Add a semicolon or {} at the end of the for loop in your original code.
29th Dec 2020, 3:05 PM
ODLNT
ODLNT - avatar
+ 2
First and foremost, you were concatenating n with only one zero ie 0+n. For the explanation, you are using prototypical inheritance. Every object in JS has a prototype object assigned to it. What you are doing is assigning a pad() method to the Number Object, so any object of number type will have access to the pad() method. I think the rest is the for loop and I think u know the syntax. https://code.sololearn.com/WCPVdBS4mMQk/?ref=app Best regards
29th Dec 2020, 6:19 PM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
0
ODLNT please i need explanation how this function work
29th Dec 2020, 3:21 PM
Abbakar_ah!!!
Abbakar_ah!!! - avatar