Object Property in JavaScript
Free Web development courses with real-time projects Start Now!!
Program 1
<html> <head> <title>Test Object Declartion in ES6</title> <script> let eid="empid" let en="empname" let ed="empdept" var obj= { [eid]:101, [en]:"Rajesh Sharma", [ed]:"IT", info() { console.log(this.empid + " " + this.empname + " "+this.empdept) } } console.log(obj) // console.log(obj.empnameITD) // console.log(obj.empdept) // let eid=101 // let ename="Vishal Sharma" // let edept="Computer Sc" // var obj={ // eid, // ename, // edept // } // console.log(obj.eid) // console.log(obj.ename) // console.log(obj.edept) </script> </head> <body> <center> </center> </body> </html>
You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google