In this video I'll be taking you step by step in detail how I solved the "Write Number In Expanded Form" challenge in 5 easy steps using javascript on FreeCodeCamp.
The steps I took to complete this challenge are as follows(I go into more detail in the video):
STEP 1
Create empty array
Create a multiplier variable
Turn number into a string
STEP 2
Iterate over all the digits starting from the last one
STEP 3
Multiply the digit and unshift it into the array unless it's a 0 in which case skip it.
STEP 4
Increase the multiplier variable ten times on every iteration
STEP 5
Join the array into a string using a + sign.
Useful links:
unshift(): https://goo.gl/hDRnsA
Download
0 formats
No download links available.
codewars javascript - Write Number In Expanded Form - SOLVED IN 5 EASY STEPS! | NatokHD