Tag: object
-

Object Inside Object in JS
<script> let user = { name: “Shairy”, sizes: { height: 182, width: 50, }, getData: function () { alert(“hello”); }, showData() { alert(this.name + this.sizes.height); }, }; user.getData(); user.showData(); alert(user.sizes.width); </script>
-

Object in JS
Object is the most important data-type for modern JavaScript that contain any combination of data-types in the form of “key: value” pairs. These keys can be variables or functions in the term of an object that can be created with curly brackets {…} <script> const person={ name:’shairy’, designation:[‘professor’,’Developer’], working:function(){ …
-

Class ,Object and Constructor in JS
A class can be defined by using a class keyword with any particular name. In JavaScript, the name of the class always starts with an uppercase letter and object is the instance of class through which we can access the member of class. Constructor is a special type of function which is call by itself…
-

PHP Classes and Objects
Create a Course class for student that display their course code and subject enrolled from an institute. Explanation Properties: course code => 101 => int datatype subject => PHP => string datatype Methods: GetData () showData () Solution The $this is in-built or self-referencing variable which refers to the current object Way 1: Define variable…