ref: dumb it down, full Ai ahead!

This commit is contained in:
AJ ONeal 2024-08-29 14:15:11 -06:00
parent 607f69e402
commit dc70e6caab
No known key found for this signature in database
GPG Key ID: F1D692A76F70CF98
2 changed files with 9 additions and 5 deletions

View File

@ -1,7 +1,10 @@
function $(sel, $parent = document) { function $(cssSelector, $parent = document) {
return $parent.querySelector(sel); let $child = $parent.querySelector(cssSelector);
return $child;
} }
function $$(sel, $parent = document) { function $$(cssSelector, $parent = document) {
return Array.from($parent.querySelectorAll(sel)); let nodeList = $parent.querySelectorAll(cssSelector);
let $children = Array.from(nodeList);
return $children;
} }

View File

@ -6,6 +6,7 @@
<script src="./ajquery.js"></script> <script src="./ajquery.js"></script>
<script> <script>
document.write("Hello, World!"); document.write("Hello, World!");
console.log($("body").textContent)); let text = $("body").textContent;
console.log(text);
</script> </script>
</body> </body>