I'm trying to do this following javascript exercise here: Create a function called mixUp. It should take in two strings, and return the concatenation of the two strings (separated by a space) slicing out and swapping the first 2 characters of each. You can assume that the strings are at least 2 characters long.
and here's my code:
var mixUP = function(a, b) {
var sliceA = a.slice(0,2);
var sliceAa = a.slice(2);
var sliceB = b.slice(0,2);
var sliceBb = b.slice(2);
var string = sliceA + sliceBb + " " + sliceB + sliceAa;
console.log(string);
};
mixUp(apple, pear);
Could anyone please help me out here coz it's not working for me. Thanks heaps!
mixUp('apple', 'pear');