JSFiddle - React, Tailwind, and code Playground

by Brock Callahan

JavaScript

let s = "this is a string";
let rand = _ => Math.round(Math.random());
alert(randomCase(s));

function randomCase(x) {
  return x.split("").map(v => {
    if (Math.round(Math.random())) {
      return v.toUpperCase();
    } else {
      return v.toLowerCase();
    }
  }).join("");
}