How to get the variable value inside the function from outside the function?
function time(){
var date=''2017'';
}
alert(date);
PHP中文网2017-05-18 11:00:18
Define global variables, write variable declarations outside the function, and use them directly inside the function
var data;
function time(){
data="2017";
}
alert(data)
给我你的怀抱2017-05-18 11:00:18
It is recommended that the questioner read the relevant knowledge about the scope of variables, which may be of great help.
phpcn_u15822017-05-18 11:00:18
var time = function(){
this._date = '2017';
}
var fn = new time;
console.info(fn._date);