Today I Learned - Rocky Kev

TIL How to check if the string is uppercase

POSTED ON:

TAGS:

How to check if the string is uppercase.

const isUpperCase = str => str === str.toUpperCase();

console.log(isUpperCase("string")); // false

console.log(isUpperCase("STRING")); // true

console.log(isUpperCase("5TR1NG")); // true

REFERENCE:
21 Useful JavaScript Snippets For Everyday Development


Related TILs

Tagged:

TIL why you should always use textContent

Today I learned the difference between 'Node.textContent'. It handles all elements, even hidden ones. It also prevents XSS attacks since it strips tags.

TIL prepend

When you're creating new elements in Javascript, you want to attach the new element to something that exists in the DOM already. You do that with append, and prepend.

TIL the simulating a Pipe function

It’s a pipe function that allows you to chain multiple operations together by taking a series of functions as arguments and applying them in a specific order to the input.