Skip to content

Instantly share code, notes, and snippets.

View Seth-Carter's full-sized avatar

Seth Carter Seth-Carter

View GitHub Profile
const getLongestWord = (string) => {
let maxLength = 0;
return Object.entries(string
.replaceAll(/\n/g, ' ')
.split(' ')
.map((word) => {
return word.replaceAll(/[^a-zA-Z]/g, '');
})
.filter(Boolean)
.reduce((hash, word) => {
function handleBuyButtonClick(event) {
console.log('You clicked a button!');
const button = event.target;
// console.log(button.textContent);
// console.log(parseFloat(event.target.dataset.price));
console.log(event.target);
console.log(event.currentTarget);
console.log(event.target === event.currentTarget);
// Stop this event from bubbling up
// event.stopPropagation();