0

How to create an array that input: ["abc","ded"] output ["*****","*abc*","*ded*","*****"],input:["a"] output ["***","*a*","***"]

14th Sep 2022, 12:52 AM
Mozzie
Mozzie - avatar
2 Answers
+ 2
Javascript : use push() and unshift() methods do add element at start and end of an array PHP : use array_push() and array_unshift()
14th Sep 2022, 6:10 AM
Roland
Roland - avatar
+ 2
Kim ... What happens if the given array has string of various length as its elements? For example -> [ "good", day" ]
14th Sep 2022, 7:04 AM
Ipang