Miscellaneous Concept In Incredible jQuery For Beginners v-3

Miscellaneous Concept In jQuery

What is Prototypical language and what is prototypical inheritance?

In general, the prototype defined as a base or referring model on which you can create your model/class/type anything. In the object-oriented world, it is called inheritance.

function Customer()

    return this.FirstName+"_"+this.LastName;

var goldCustomer=new Customer();

    console.log("I am gold Customer");

var silverCustomer=new Customer();
    console.log("I am Silver Customer");



In JavaScript, we use object-oriented inheritance. See above example, in this, we create Constrictor function which acts like prototype after this we have created goldcustomer object which is derived from our Customer prototype after this we have added the DisplayCustomer function in that and same way we create silver customer in that we added DisplayCustomer1 function.

We inherit property from base class and child have their own add on functionality like that we have created.

Means what we did we are creating a new object and we are attaching new method to those objects. So why people called JavaScript is prototype language because of this, we are created object-based on prototype and on that we are adding new functions from which we get a new flavor of object.

But when worked on big project we are not going to add such one functions at a time rather than we add full constructor method.

function Customer() {
    this.FirstName = "";
    this.LastName = "";

    this.DisplayName = function () {
        return this.FirstName + "_" + this.LastName;

function CustomerType() {

    this.GoldCustomer = function () {
        console.log("I am Gold Customer");
    this.SilverCustomer = function () {
        console.log("I am Silver Customer");
CustomerType.prototype=new Customer();

var x=new CustomerType();
x.FirstName="Sagar";  //parent property
x.LastName="Jaybhay"; //parent property
console.log(x.DisplayName());//parent method
x.GoldCustomer(); //child method
x.SilverCustomer();//child method

what is a prototype object?

It is an object which points to another object. JavaScript engine adds a prototype property inside a function, Prototype property is basically an object (also known as Prototype object), where we can attach methods and properties in a prototype object, which enables all the other objects to inherit these methods and properties.

Every javascript object has a prototype.

Miscellaneous Concept In Incredible jQuery For Beginners v-3

Prototype Object follows the method chaining fundamentals.

what is method chaining in jQuery?

In the above example, we have Display method in base means prototype and another method their respective function. When we call DisplayName

A method it will first check their own implementation means whether the method is present in that or not if not then it will check it’s base or prototype to check whether the method is present or not if he doesn’t find then it will check in prototype object. If their also not found then it will throw an error.

3 Important Rules

  1. A prototype is a simple object who point’s to another object.
  2. Every javascript object has a prototype
  3. Javascript have fallback method chaining, this method chaining also called as prototypical inheritance.

What is the use of document.ready in jQuery?

The responsibility of the rendering engine is well… Rendering,that is a display of the requested contents on the browser screen.

By default, the rendering engine can display HTML and XMLdocuments and images.

Different browsers use different rendering engines: Internet Explorer uses Trident, Firefox uses Gecko, Safari uses WebKit. Chrome and Opera (from version 15) use Blink, a fork of WebKit.

Miscellaneous Concept In Incredible jQuery For Beginners v-3

The rendering enginewill start parsing the HTML document and convert elements to DOM nodes in a tree calledthe “content tree”. The engine will parse the style data, both inexternal CSS files and in style elements. Styling information together withvisual instructions in the HTML will be used to create another tree: the rendertree.

It’s important tounderstand that this is a gradual process. For better user experience, therendering engine will try to display contents on the screen as soon aspossible. It will not wait until all HTML is parsed before starting to buildand layout the render tree. Parts of the content will be parsed and displayed,while the process continues with the rest of the contents that keeps comingfrom the network.

So if we want to perform some operation on any element and which is not render till the code doesn’t work. So to ensure the code will work is that we need to know somehow a document is loaded completely in memory so document.ready are used which ensure that document is completely loaded in memory so we can perform any operation. In below example we write script code before Html added but this will work because we used this function in document.ready function.

        JQuery Demos
    <script src="https://ajax.googleapis.com/ajax/libs/d3js/5.12.0/d3.min.js"></script>
    <h1>Hello Sagar</h1>

        $(document).ready(function () {
            $("#txtname").val('Jquery Is Present ');

    <input type="text" id="txtname" />


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *