There are three ways to define JS objects
There are three ways of defining JS methods
function fn () {}
var fun = function () {}
var fun = new function () {}
//******** *********************************//
<! DOCTYPE html>//var a = "123"; //function fn () { //alert (a); //var ab = "4321"; // } //fn (); //new Object (); //create a normal object varA = 3, B = 9; varobj = { //Defining PropertiesName: "123", Fun1:function () { } } //obj.name = "haha";OBJ.FUN1 =function(A, b) {alert ("Iosdjfoij"); returnA +b; } //Delete obj.name; //alert (obj.name); //Alert (Obj.fun1 (A, b)); //Constructor declaration, which can be understood as a class in Java, a class is an object functionObj () {//In the constructor mode in Java This. Name = "Hahaa"; This. fun1 =function(A, b) {returnA +b; } } //to use the constructor, you must instantiate the constructor, create the object varOBJJ =NewOBJ (); Objj.name= "HelloWorld"; //Objj.fun1 (A, b) { //return a+b; //} //Modify object, Format: Small object. Method Small object. Properties //Add New Object //format: Small object. New method =Objj.func23 =function () { return("No. Third"); } alert (Objj.name); Alert (objj.func23 ()); //Alert (Objj.fun1 (A, b)); //crud Operations on objects</script>JavaScript Object definitions and operations