function slugify(str) {
  str = str.replace(/^\\s+|\\s+$/g, ''); // trim leading/trailing white spaces
  str = str.toLowerCase(); // convert string to lowercase
  str = str.replace(/[^a-z0-9 -]/g, '') // remove any non-alphanumeric characters
           .replace(/\\s+/g, '-') // replace spaces with hyphens
           .replace(/-+/g, '-'); // remove consecutive hyphens
  return str;
}

display: none after opacity (etc) transition:

72A89790-01A9-4A38-B682-D3A438D5AB1B.jpeg

// add stylesheet in the document <head>
function addCss(fileName) {
  const head = document.head
  const link = document.createElement("link")
  link.type = "text/css"
  link.rel = "stylesheet"
  link.href = fileName
  head.appendChild(link)
}
// add non-breaking space character before last word
function replaceLastSpace(input){
  const outputArr = input.split("")
  outputArr[input.lastIndexOf(" ")] = "&nbsp;"
  return outputArr.join("")
}

E2B74D11-4DC4-45E4-BF7A-CE483E3CF3BB.jpeg


You can use the removeProperty method to remove a specific inline CSS property defined in the style attribute.

https://res.cloudinary.com/dp3mem7or/image/upload/w_440//til/til34.png

https://codepen.io/matuzo/pen/OJyQgmr


The nullish coalescing operator (??) only returns its right-hand side operand when its left-hand side operand is null or undefined.

https://res.cloudinary.com/dp3mem7or/image/upload/w_440//til/til36.png

https://codepen.io/matuzo/pen/YzwJRaN?editors=1012