2

firstly, does anyone know of an online telegram or whatsapp group where i can ask silly stuff regarding web dev and get immediate answers, just like it is here?

secondly i am trying to learn js and there are just too many related terms that are messing with my brain:
"some features are supported ines5/es6/es15/es16/es17 , some are supported in chrome's v8/chakra/spidermonkey/android browser , some features are only supported in "serverside" and blocked in all browsers thanks to browser's vm environment; babel can't read this code, some features are provided only by node js..."
WHAT THE MESS IS THIS?

All i am trying to do is to write code that would make a website visible to everyone. if by specific browser , i want to target, chrome and its subsidaries and android chrome/other android browsers .
for other browsers am willing to make external converters later but don't want to change my code by 1 bit. And from what i know, each browser (at least the browsers am thinking of supporting) has the complete JS compilers already built in

can i or can i not built a complete functional website with those things?

and finally my main question : how to make custom exceptions in vanilla js? i saw this answer on stack overflow:
===================
function InvalidArgumentException(message) {
this.message = message;
// Use V8's native method if available, otherwise fallback
if ("captureStackTrace" in Error)
Error.captureStackTrace(this, InvalidArgumentException);
else
this.stack = (new Error()).stack;
}

InvalidArgumentException.prototype = Object.create(Error.prototype);
InvalidArgumentException.prototype.name = "InvalidArgumentException";
InvalidArgumentException.prototype.constructor = InvalidArgumentException;

Usage:

throw new InvalidArgumentException();
var err = new InvalidArgumentException("Not yet...");

=====================================

where is the error code? what would be the exception details? what is the line number/timestamp of error?why is that function making an error, i thought error/exception is a class in JS?

Comments
  • 5
    😧why on earth are you restricting access to your site for a single browser - unless you are making a very specific feature that only Chrome can actually handle, like Chrome Experiments.

    This isn't 2005 anymore, prototypes are exactly that, so browser support is still going to play a factor here as well.

    As for custom error handling.... it's usually a bad idea to reinvent the wheel for something that already exists natively but what ever, just extend the error class and add your own functionality.

    https://javascript.info/custom-erro...
  • 0
    For your first question, there's Freenode, the IRC server, I usually go there when I don't know what to look up on Google or when my problem is way too specific. There are channels for pretty much any major open-source project there, and the largest channels easily top or get close to a thousand users at any given time. The IRC client I've most often used lately is Hexchat, but I kinda just settled with it and might be very well missing out on possibly better clients.

    In case you're too young to be familiar with IRC (with it being named as such), it's basically kinda like Discord but there's no single company providing all servers/networks (it's just a protocol), people may setup a network by themselves and others may join and just pick a nickname (or even register their nickname with the "nick server"). IRC networks used to be a place where normal people with computers socialized online before social networks and smartphones, now you mostly only have tech folk there still using it.
  • 0
    classes are just a fancy syntax for functions with prototypes. so this:

    ```

    class A {

    constructor() {

    this.letter = "a";

    }

    say() {

    console.log(this.letter);

    return this.letter;

    }

    }

    ```

    transforms into this:

    ```

    function A() {

    this.letter = "a";

    }

    A.prototype.say = function() {

    console.log(this.letter);

    return this.letter;

    }

    ```

    EDIT: devRant what the fuck did you do to indentation
  • 0
    This is why I hate post-modern js. Nothing will ever replace the joy that alert() brings.
Add Comment