dimanche 25 décembre 2016

Test in javascript

Can you help me please.

During a test, I did not understand this question :

Given the following code, write two lines of Javascript to call the print() function in a way that prints the Window global object in the Javascript console ? Your code must not use the variable window. Feel free to comment.

Printer = function(){
    this.print = function() {
       console.log(this);
    }
}
var printer = new Printer();

Aucun commentaire:

Enregistrer un commentaire