About 50 results
Open links in new tab
  1. Class keyword in JavaScript 1.x - Stack Overflow

    Nov 13, 2009 · The class keyword is no more than syntactic sugar on top of the already existing prototypal inheritance pattern. Classes in javascript is basically another way of writing constructor …

  2. javascript - What exactly does the "class" keyword actually do? How is ...

    Dec 5, 2023 · Additionally, the function Hero (name, level) has parameters, whereas the class Hero (which again - we said is a function) does not. So I am left wondering what exactly the class keyword …

  3. javascript - How to add a class to a given element? - Stack Overflow

    Nov 28, 2016 · What does adding a class to a DOM element have to do with learning the language? document.getElementById ('div1').className is as much a library related issue as using jQuery to do …

  4. How can I change an element's class with JavaScript?

    How can I change the class of an HTML element in response to an onclick or any other events using JavaScript?

  5. What techniques can be used to define a class in JavaScript, and what ...

    Dec 23, 2008 · The best way to define a class in JavaScript is to not define a class. Seriously. There are several different flavors of object-orientation, some of them are: class-based OO (first introduced by …

  6. oop - Does JavaScript have classes? - Stack Overflow

    May 2, 2010 · 29 Javascript is an object oriented programming language, nevertheless in 2015 with ECMA script 6 classes have been introduced and now is correct to use them like other class based …

  7. javascript - How can I invoke asynchronous code within a constructor ...

    Apr 16, 2017 · JavaScript class es can return literally anything from their constructor, even an instance of another class. So, you might return a Promise from the constructor of your class that resolves to …

  8. javascript - JS getters and setters inside a class? - Stack Overflow

    I'd like to create a class in JS that uses native getters and setters. I know I can create getters/setters for objects, like so: var obj = { get value () { return this._value; }, ...

  9. Remove CSS class from element with JavaScript (no jQuery)

    Jan 28, 2010 · Could anyone let me know how to remove a class on an element using JavaScript only? Please do not give me an answer with jQuery as I can't use it, and I don't know anything about it.

  10. How can I add a class to a DOM element in JavaScript?

    Jul 12, 2009 · 48 3 ways to add a class to a DOM element in JavaScript There are multiple ways of doing this. I will show you three ways to add classes and clarify some benefits of each way. You can …