Here is an array for you
(2) ['beginning=beginner', 'leaves=leave']
as well as a string
its beginner in the sounds leave
that has been converted to an array using the following code
var words = text.split(' ');
My goal is to replace beginner
with beginning
and leave
with leaves
. Since there are only two elements for now, I plan to do it within a for loop. Can this be achieved using the map method?
this.words.map((words, i) => console.log(words));
Important: Only the first instance should be replaced.
If you have any solutions, I would greatly appreciate it. Thank you