Miro Interview Question

String manipulation based question in Javascript