This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class PersonNode: | |
def __init__(self, name=None, eligible_nodes=None, exclusions=None): | |
self.name = name | |
self.eligible_nodes = eligible_nodes if eligible_nodes is not None else [] | |
self.exclusions = exclusions if exclusions is not None else set() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |