zoukankan      html  css  js  c++  java
  • 面试题总结

    fn()
    function fn () {
    console.log(12)
    }
    var as = function () {
    console.log(45)
    }

     

    var a = 12;
    function fn () {
    console.log(a)
    var a = 45;
    console.log(a)
    }
    fn()

     

    var a = 12;
    function fn () {
    console.log(a)
    a = 45;
    console.log(a)
    }
    fn()

     

    function fn () {
    console.log(11)
    function ff () {
    console.log(22)
    }
    ff()
    }
    fn()

     

    function fn () {
    console.log(5)
    fn()
    }
    fn()

     

    function fn () {
    console.log(12)
    }
    var as = fn()
    console.log(as)

     

    function fn () {
    console.log(12);
    return 45;
    console.log(456)
    }
    var as = fn()

     

    var a = 12;
    function fn () {
    console.log(a);
    return 4;
    var a = 45;
    }
    fn()

     

    var a = 45;
    function fn () {
    console.log(a)
    }
    fn()

     

    var a = 45;
    function fn (a) {
    console.log(a)
    }
    fn(5)

     

    var a = 123;
    function fun () {
    alert(a);
    }
    fun()

     

    var a = 123;
    function fun () {
    alert(a);
    var a = 456;
    }
    fun();
    alert(a);

     

    var a = 123;
    function fun () {
    alert(a);
    a = 456;
    }
    fun()
    alert(a)

     

    var a = 123;
    function fun (a) {
    alert(a)
    a = 456;
    }
    fun()
    alert(a)

     

    var a = 123;
    function fun (a) {
    alert(a)
    a = 456
    }
    fun()
    alert(a)
     

     

    function makeNoSense (x) {
    this.x = x;
    }
    makeNoSense(5);
    console.log(x);
    function test () {
    this.x = 1;
    alert(this.x);
    }
    test();
     
     

     

    this

     

    var name = '222';
    var a = {
    name : '111',
    say : function () {
    console.log(this.name)
    }
    }

    var fun = a.say;
    fun() //???
    a.say() //???

    var b = {
    name : '333',
    say : function (fun) {
    fun();
    }
    }
    b.say(a.say); //???
    b.say = a.say;
    b.say() //???
     

     

    var val = 1
    var obj = {
    val : 2,
    dbl : function() {
    var val = 45;
    console.log(this); //指向谁?
    this.val *= 2;
    console.log(this.val); //??
    console.log(val); //??
    }
    }
    var fn = obj.dbl
    fn()

    var x = 12;
    function test() {
    console.log(this.x)
    }
    test() //??

     

    var x = 12;
    function test() {
    console.log(this.x)
    }
    var obj={
    x:45,
    ss:test
    }
    obj.ss() //??

     

    var x = 12;
    function test() {
    console.log(this.x)
    }
    var obj = {
    x:45,
    ss:function(){
    console.log(this)
    test()
    }
    }
    obj.ss() //??

     

    var val = 1
    var obj = {
    val : 2,
    dbl : function() {
    // var val = 45;
    console.log(this); // 指向谁
    this.val *= 2;
    console.log(this.val); // ???
    console.log(val); // ???
    }
    }
    var ff = obj.dbl()

    本人qq  2411892678 如有大佬加q一起深入学习it

  • 相关阅读:
    面向对象-继承
    antd pro2.0 使用记录一:登录/注册/底部版权等设置
    vscode中git的配置
    电脑桌面文件夹出现在屏幕之外了,怎么解决
    百度网盘不限速-Motrix
    u盘在电脑读不出来,但别的可以读
    win10 命令重置 管理员密码
    nginx 配置
    react 记录:运行npm run eject命令暴露配置文件都报这个错误
    浏览器 连不上网 (3):DNS 服务器问题
  • 原文地址:https://www.cnblogs.com/zhangao/p/10055112.html
Copyright © 2011-2022 走看看