Given two strings, append them together (known as “concatenation”) and return the result.





Test cases:

Test cases Expected Result
stringConcat(Hello,World) Hello World OK
stringConcat(Code,ranch) Code ranch OK
stringConcat(Web,Application) Web Application OK

Java solution:

public class Program5 {
	public static void main(String[] args) {
		Program5.stringConcat("Hello","World");
		Program5.stringConcat("Code","ranch");
		Program5.stringConcat("Web","Application");
	}
	public static String stringConcat(String a,String b){
		return a+" "+b;
	}
}

Javascript solution:

const stringConcat = (a, b) => {
    return a +' '+ b;
}

console.log(stringConcat("Hello", "World")); //Hello World
console.log(stringConcat("Code","ranch")); //Code ranch
console.log(stringConcat("Web","Application")); //Web Application

 

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

Leave a Reply