You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 1. Have a clear, descriptive name like funPhrase.
58
+
functionfunPhrase(str){
59
+
if(str.length<=3){
60
+
returnstr.slice(str.length-1);
61
+
}else{
62
+
returnstr.slice(0,3);
63
+
}
64
+
}
65
+
letstr1="functions Rock!";
66
+
console.log(funPhrase('apple'));
67
+
console.log(funPhrase('be'));
68
+
console.log(`We put the ${funPhrase(str1)} in ${str1}.`);
36
69
// 2. Retrieve only the last character from strings with lengths of 3 or less.
37
70
// 3. Retrieve only the first 3 characters from strings with lengths larger than 3.
38
71
// 4. Use a template literal to return the phrase We put the '___' in '___'. Fill the first blank with the modified string, and fill the second blank with the original string.
0 commit comments