sapui5 - this._helloDialog in OpenUI5 walkthrough -


i new javascript , openui5. going through walkthrough demo on openui5 websiteopenui5 walkthrough demo

i came through below code:

sap.ui.define([     "sap/ui/core/uicomponent",     "sap/ui/model/json/jsonmodel",     "sap/ui/demo/wt/controller/hellodialog"  ], function (uicomponent, jsonmodel, hellodialog) {     "use strict";     return uicomponent.extend("sap.ui.demo.wt.component", {         metadata : {             manifest : "json"         },         init : function () {             // call init function of parent             uicomponent.prototype.init.apply(this, arguments);             // set data model             var odata = {                 recipient : {                    name : "world"                 }             };             var omodel = new jsonmodel(odata);             this.setmodel(omodel);              // set dialog             this._hellodialog = new hellodialog(this.getrootcontrol());         },          openhellodialog : function () {             this._hellodialog.open();         }     }); }); 

i have doubt in line this._hellodialog = new hellodialog(this.getrootcontrol());

if _hellodialog not defined , using strict mode, why system not throw message _hellodialog undefined?

_hellodialog property of this (the controller), , properties not need initialized when creating object.

 "use strict"  var example = {};  example.newproperty = "i new property"; //this absolutely correct    undefinedvariable = 1; // going throw error

strict mode prevents implicitly creating global variables (as undefinedvariable = 1; do). not going prevent adding property object.

if interested on preventing creation of properties, suggest reading freeze vs seal


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -