Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Javascript

Check if string contains only alphanumeric characters

// ref: https://www.30secondsofcode.org/js/s/is-alpha-numeric
const isAlphaNumeric = str => /^[a-z0-9]+$/gi.test(str);

Improve scrolling

// ref: https://www.30secondsofcode.org/articles/s/passive-scroll-listener-performance
// The speed improvement comes from the `{ passive: true }`
window.addEventListener('scroll', () => {
    // Do something here
    // We can not use `preventDefault` at this place
}, { passive: true })

Construct an url

// ref: https://www.30secondsofcode.org/articles/s/js-construct-url
@todo

Replace or append

// ref: https://www.30secondsofcode.org/js/s/replace-or-append
@todo

Select focused DOM element

// ref: https://www.30secondsofcode.org/articles/s/select-focused-dom-element
const focusedElement = document.activeElement;

Validate an email address in javascript

@todo

Link