External Resources
Each browser maker has their own Developer Tools: they’re not standardized, so you may prefer one over the other for certain tasks.
- Firefox Browser Console
- Chrome: Console Utilities
See Values of Variables in the JS Console
var_name;
console.log(var_name);
console.table(array_name);Get versions of jQuery-ui and jQuery:
# jQueryUI:
$.ui; // before 1.6
$.ui.version; // 1.6 and later.
# jQuery itself:
jQuery().jquery;
Highlight all liks
for (l of document.links){l.style.border="4px solid red"}List and highlight links that contain ‘copyright’ or some other string
for (link of document.links) {
if(link.href.indexOf ('copyright')!= -1){
console.log(link.href);
link.style = "border: 5px solid blue";
}
} Identify links to other domains
for(link of document.links) {
if (link.href.indexOf(location.host) == -1){
console.log(link.href); }
}
// location === window.location === document.location
// like document.location.host, there's also
// .protocol
// .port
// .pathname
// .search (query string)
// .hash
// .originGet the URL of every image
const pic_urls = [];
for(pic of document.images){
pic_urls.push(pic.src);
}
console.log(pic_urls);