JSFiddle - React, Tailwind, and code Playground

by OndrejHj04

JavaScript

let str1 = "javascript";  

// Example output: 
// jZvZsZrZpZ OR each letter on a new line
// HINT: You can use  if((i+1) % 2 == 0) to check for even indexes 


const res = [...str1].map((letter, index)=>{
  return index % 2 != 0 ? "Z" : letter
})

console.log(res.join(""))