Answers for "if class has property javascript"

39

javascript check if element has class

if(document.getElementById("myElmentID").classList.contains("hidden")){
// I have the 'hidden' class
}
Posted by: Guest on August-02-2019
6

js check if object has property

const object1 = new Object();
object1.property1 = 42;

console.log(object1.hasOwnProperty('property1'));
// expected output: true
Posted by: Guest on April-13-2020
3

check if js property exists in class

myObj.hasOwnProperty(myProp)
Posted by: Guest on February-12-2020

Code answers related to "if class has property javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language