2020.09.23
请写出弹出值,并解释为什么
alert(a)
a();
var a = 3;
function a(){
alert(10)
}
alert(a)
a = 6;
a();
请写出如下输出值, 并写出把注释掉的代码取消注释的值,并解释为什么
this.a = 20;
var test = {
a: 40,
init: ()=>{
console.log(this.a)
}
go.prototype.a = 50;
return go;
}
// var p = test.init()
// p();
new(test.init())
function C1(name){
if(name) this.name = name;
}
function C2(name){
this.name = name;
}
function C3(name){
this.name = name || 'fe'
}
C1.prototype.name = 'yideng';
C2.prototype.name = 'lao';
C3.prototype.name = 'yuan';
console.log((new C1().name) + (new C2().name) + (new C3().name))
写出输出值,并解释为什么
function test(m){
m : {v : 5}
}
var m = {k : 30}
test(m);
alert(m.v)
请写出代码执行结果,并解释为什么
function yideng(){
console.log(1)
}
(function(){
if(false){
function yideng(){
console.log(2)
}
}
})()
请用一句话遍历变量a(禁止用for 已知var a = "abc")
var length =12;
function init(){
console.log(this.length)
}
var yideng = {
length: 5,
method: function(){
fn();
arguments[0]()
}
}
8. 请在下面写出JavaScript 面向对象编程的混合式继承, 并写出ES6版本的继承。
最后更新于
这有帮助吗?