I'm trying to create "nested functions". But i can't seem to find a solution!
const func1 = (value1) => {
const func2 = (value2) => {
console.log(value1 + value2)
}
}
func1(2).func2(3)
What i really want to accomplish is create my own little "jQuery function"
const $ = (element) => {
const addClass = (name) => {
const x = document.querySelectorAll(element);
for (i = 0; i < x.length; i++) {
x[i].className = name
}
}
}
$('#circle').addClass('nice')
func1(2).func2(3)– Herefunc1()returns an object which has a methodfunc2…