JSFiddle - React, Tailwind, and code Playground

by anand potta

HTML

<h1>Code Test 2</h1>
<pre id="output"></pre>

JavaScript

// Code goes here
function toTitleCase(str) {
  str = str.toLowerCase()
  if(str.length > 0){
    str = str.charAt(0).toUpperCase() + str.substr(1)
  }
  return str
}
const input = [{
        "dayOfWeekId": "1",
        "dayName": "SUNDAY",
    }, {
        "dayOfWeekId": "2",
        "dayName": "MONDAY",
    }, {
        "dayOfWeekId": "3",
        "dayName": "TUESDAY",
    }, {
        "dayOfWeekId": "4",
        "dayName": "WEDNESDAY",
    }, {
        "dayOfWeekId": "5",
        "dayName": "THURSDAY",
    }, {
        "dayOfWeekId": "6",
        "dayName": "FRIDAY",
    }, {
        "dayOfWeekId": "7",
        "dayName": "SATURDAY",
    }];
    
const output = input.filter(e => (e.dayName.charAt(0) === 'T'))
document.querySelector('#output').innerHTML = JSON.stringify(output, null, 2)