Message from JavaScript discussions

April 2019

— Someone please suggest a good youtube series to learn Angular


Guys I have a question.
I have a lot of classes where I querySelect a lot of DOM nodes in the constructor. I dont know a clean way to handle the errors. When one selector fails the next one will fail aswell. And I dont want to wrap each one in a condition or try catch. e.g:

constructor(params) { = document.querySelector(params.selector1); =;

Anyone an idea?

— TRGWII do you have an idea?😁

— You mean when foo is null?

— For instance?

— Yeah

— Why not just make the user pass the element instead of the selector?


const foo = document.querySelector('foo');

new MyClass({ foo });

— Or something

— This is done with vue-directives. I pass the selector in the html.

— Okay... just map I guess

— V-foo="{ selector1: '.bar' }"