0
Pls help
You work as an Intelligence Agent, overseeing everyone's conversations. Your job is to find passwords or secret passwords from people's messages. Make a function code to crack the secret passwords of people's conversations Example: c0m3 t0 P1zz4Pl4z4 th1s n18ht, $3çr3t!! Output: come to PizzaPlaza this night, Secret!! Code: function encode(word) { //your code goes here } encode("H3llo, w3 mu$t m33t 1n 8r4nd C1ty t0n18ht. 1 h4v3 wh4t y0u w4nt, br1n8 th3 m0n3y")
1 Odpowiedź
+ 3
Hint:
Make an object with numeric string as property names, and the respective character as the property value.
obj = { "4", "a", "3" : "e", "1" : "i" }
Add more as you see fit.
Then iterate through the object, and use String::replaceAll() method to replace each occurence of property-name in the given string argument with that of the property-value.