Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

// Write a function that takes two strings (a and b) as arguments // If a contains b, append b to the beginning of a // If not, append it to the end // Return the concatenation

// Write a function that takes two strings (a and b) as arguments
// If a contains b, append b to the beginning of a
// If not, append it to the end
// Return the concatenation
function
myFunction(a, b) {
return a.includes(b) ? b + a : a + b;
}
 
PREVIOUS NEXT
Tagged: #Write #function #takes #strings #arguments #If #append #beginning #If #append #Return #concatenation
ADD COMMENT
Topic
Name
6+9 =