October 22nd, 2024
What's missing in this code?
func('aBcDeF'); // 'BDFace'
func('abcdef'); // 'abcdef'
func('ABCDEF'); // 'ABCDEF'
func('a b C D e'); // ' C D a b e'
func('aaBBccDD'); // 'BBDDaacc'
function func(str) {
const func = (transform) =>
[...str].
((char) => char ===
.join('');
const str1 = func((char) => char.toUpperCase());
const str2 = func((char) => char.toLowerCase());
return
+
;
}
Type or select from these options