In the code below,
the forEach
method is used to
convert the sizes in the sizesInCentimeters
array
to its equivalent size in meters
.
This is bad code since,
it not only mutates the sizesInCentimeters
array
but the name "sizesInCentimeters"
does not make sense after
the values have been converted to meters.
Rewrite this code to create
a new array sizesInMeters
that contains values from
the sizesInCentimeters
array
after dividing them by 100
.
Use console.log()
to display both
sizesInCentimeters
and sizesInMeters
arrays.
For example: