Skip to main content


Showing posts with the label reverse string

Javascipt Interview Question and Answers - 2

In this article, I am going to take 3 question which are frequently asked in Javascript interviews. These questions are somewhat linked with the concept of reversing string. These are asked to check the logical ability and approach. “ Give someone a program, you frustrate them for a day; teach them how to program, you frustrate them for a lifetime. ” Let start with an easy one Q1. Write a program to reverse the string/word.e.g. if input is 'india', the output should be 'aidni'. Condition is, the solution should be with minimal lines of code. So pause for a moment, think about it and them reach out to the solution. To solve this problem, we need to think, how we can reverse the string, do we have any in built function to reverse a string? Or should we loop through each character of string from last and assign to new string? Or any other approach? We don't have any built-in function like reverse for a string but we do have for array, Can we make a string