0
I want this function to take value x and return 00X but it didn't work why please?
3 odpowiedzi
+ 2
Add a semicolon or {} at the end of the for loop in your original code.
+ 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
0
ODLNT please i need explanation how this function work