Posts by retr0 • 55 points
4 posts
-
2
votes2
answers53
viewsQ: How can I exchange elements of a string using the values of an object as argument?
I have this code: const operators = { plus : '+', minus : '-', multiplied : '*', divided : '/' } let question = 'What is 4 plus 6?'; let matchs = question.match(/\d|plus|minus|multiplied|divided/g);…
-
0
votes1
answer130
viewsQ: How to change a specific value of a string in an array?
I have an array: let arr = ['Feijao, Arroz', 'Melancia', 'Banana', 'Laranja,Uva'] and would like her to become: let arr = ['Feijao, Arroz', 'Melancia', 'Banana', 'Laranja, Uva']//(consertando o erro…
-
0
votes2
answers43
viewsQ: How can I turn a string of numbers into a Matrix?
I’m doing an exercise where I should extract rows and columns from a string, creating an array. Input let str = '1 2 3\n4 5 6\n7 8 9', I wrote a code that returns: [ '4 5 6' ], but I’d like him to…
-
0
votes2
answers72
viewsQ: Two identical arrays returning false when compared
I need help with this code that doesn’t seem to make sense. I have debugged and the values given up to the penultimate line are: splited = ["i","s","o","g","r","a","m"] unique =…