Answer the question
In order to leave comments, you need to log in
What is wrong with replay?
The code throws an error
return tmp[len].replace(/{name}/g, (item, i) : string =>
export const likes = (a: string[]) : string => {
let len: number;
let tmp: string[] = [
"no one",
"{name}",
"{name}, {name}",
"{name}, {name}, {name} ",
"{name}, {name} and others"
]
a.length > 3 ? len = 4 : len = a.length;
console.log(tmp[len]);
return tmp[len].replace(/{name})/g, (item, i) : string => {
if(item == '{name}') return a[i];
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question