012_call and Apply Differences

Source: Internet
Author: User
Tags deprecated

One

function fn (A, b) {console.log (this);}           Fn.call (null,1,2);     Call is the parameter mode fn.apply (null,[1,2]);  Apply array Way/* Output =>object [global] {dtrace_net_server_connection: [function], dtrace_net_stream_end: [function], Dtrace_http_server_request: [function], dtrace_http_server_response: [function], dtrace_http_client_request: [ Function], dtrace_http_client_response: [function], global: [Circular], process:process {title: '/usr/local/bin /node ', version: ' v10.3.0 ', versions: {http_parser: ' 2.8.0 ', node: ' 10.3.0 ', V8: ' 6.6.346.32-n         Ode.9 ', UV: ' 1.20.3 ', zlib: ' 1.2.11 ', Ares: ' 1.14.0 ', modules: ' + ', NGHTTP2: ' 1.29.0 ', Napi: ' 3 ', OpenSSL: ' 1.1.0h ', ICU: ' 61.1 ', Unicode: ' 10.0 ', Cldr: ' 33.0 ', TZ: ' 2018c ', Arch: ' x64 ', Platform: ' Darwin ', release: {Name: ' node ', sourceURL: ' https://no Dejs.org/download/release/v10.3.0/node-v10.3.0.tar.gz ',       Headersurl: ' https://nodejs.org/download/release/v10.3.0/node-v10.3.0-headers.tar.gz '}, argv: [' /usr/local/cellar/node/10.3.0/bin/node ', '/users/00arunalldata00/009_mystudy/010_everest/001_everest4/20180628/ 201804/7.fs/11.fn.js '], execargv: [], env: {PATH: '/usr/local/opt/openssl/bin:/opt/vagrant/bin:/usr /local/sbin:/usr/local/opt/sqlite/bin:/usr/local/opt/openresty-openssl/bin:/usr/local/opt/icu4c/sbin:/usr/ local/mysql/bin:/usr/local/opt/icu4c/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/ Applications/wireshark.app/contents/macos ', nvm_rc_version: ', Force_color: ' True ', Electron_no_atta Ch_console: ' True ', debug_colors: ' True ', Npm_config_color: ' Always ', mocha_colors: ' 1 ', versi Oner_python_version: ' 2.7 ', LOGNAME: ' Arunyang ', Nvm_nodejs_org_mirror: ' Https://nodejs.org/dist ', XP  C_service_name: ' com.jetbrains.webstorm.77156 ', PWD:       '/users/00arunalldata00/009_mystudy/010_everest/001_everest4/20180628/201804/7.fs ', NVM_CD_FLAGS: '-Q ', Nvm_dir: '/USERS/ARUNYANG/.NVM ', SHELL: '/bin/zsh ', PAGER: ' Less ', lscolors: ' Gxfxcxdxbxegedabagac Ad ', Securitysessionid: ' 186a8 ', oldpwd: '/applications/webstorm.app/contents/bin ', versioner_python_ Prefer_32_bit: ' No ', USER: ' Arunyang ', ZSH: '/users/arunyang/.oh-my-zsh ', TMPDIR: '/var/folders/wy/v0 w9vkf52836x21w_jz2wzlh0000gn/t/', Ssh_auth_sock: '/private/tmp/com.apple.launchd.iktjc3zbdp/listeners ', XPC_        FLAGS: ' 0x0 ', Nvm_iojs_org_mirror: ' Https://iojs.org/dist ', __cf_user_text_encoding: ' 0x1f5:0x0:0x0 ',        Apple_pubsub_socket_render: '/private/tmp/com.apple.launchd.hubmuc0k3m/render ', Less: '-R ', Lc_ctype: ',        HOME: '/users/arunyang ', pid:3023, features: {debug:false, uv:true, Ipv6:true,     Tls_alpn:true,   Tls_sni:true, Tls_ocsp:true, tls:true}, ppid:2534, Execpath: '/usr/local/cellar/node/10.3.0/ Bin/node ', debugport:9229, _startprofileridlenotifier: [Function: _startprofileridlenotifier], _stopprofileri Dlenotifier: [function: _stopprofileridlenotifier], _getactiverequests: [function: _getactiverequests], _getactive Handles: [Function: _getactivehandles], reallyexit: [Function:reallyexit], Abort: [Function:abort], chdir: [ Function:chdir], CWD: [FUNCTION:CWD], umask: [Function:umask], Getuid: [Function:getuid], geteuid: [Fu Nction:geteuid], setuid: [Function:setuid], Seteuid: [Function:seteuid], setgid: [Function:setgid], SE Tegid: [Function:setegid], Getgid: [Function:getgid], Getegid: [Function:getegid], getgroups: [Function:ge     Tgroups], setgroups: [Function:setgroups], initgroups: [Function:initgroups], _kill: [Function: _kill], _debugprocess: [Function: _debugprocess], _debugend: [Function: _debugend], hrtime: [Function:hrtime], CPUUsage: [Function:cpuusage]  , Dlopen: [Function:dlopen], uptime: [Function:uptime], memoryusage: [Function:memoryusage], _rawdebug: [Function], moduleloadlist: [' Binding contextify ', ' nativemodule events ', ' Nativemodule internal/ Async_hooks ', ' nativemodule internal/errors ', ' binding uv ', ' binding buffer ', ' binding async_w        Rap ', ' binding config ', ' binding ICU ', ' nativemodule util ', ' Nativemodule internal/encoding ', ' Nativemodule internal/util ', ' Binding constants ', ' binding util ', ' Nativemodule internal/util /types ', ' Internal Binding types ', ' nativemodule buffer ', ' nativemodule internal/buffer ', ' Nat ' Ivemodule internal/process ', ' nativemodule assert ', ' nativemodule internal/assert ', ' Nativemodule FS ' , ' Nativemodule pAth ', ' nativemodule internal/constants ', ' Binding fs ', ' Nativemodule stream ', ' nativemodule in Ternal/streams/pipeline ', ' nativemodule internal/streams/end-of-stream ', ' Nativemodule Internal/streams/lega Cy ', ' Nativemodule _stream_readable ', ' nativemodule internal/streams/buffer_list ', ' nativemodule inte Rnal/streams/destroy ', ' nativemodule internal/streams/state ', ' nativemodule _stream_writable ', ' Nativ Emodule _stream_duplex ', ' nativemodule _stream_transform ', ' nativemodule _stream_passthrough ', ' Bindi Ng Fs_event_wrap ', ' nativemodule internal/fs/utils ', ' nativemodule internal/url ', ' nativemodule Inter Nal/querystring ', ' Binding url ', ' Nativemodule internal/process/warning ', ' Nativemodule internal/proc Ess/next_tick ', ' nativemodule internal/process/promises ', ' nativemodule internal/fixed_queue ', ' Nativ Emodule internal/process/stdio ', ' binding performance ', ' Binding trace_events ', ' Nativemodule internal/inspector_async_hook ', ' Binding Inspector ', ' Nativemodule timers ', ' binding timer_wrap ', ' Nativemodule internal/link Edlist ', ' nativemodule internal/timers ', ' nativemodule internal/modules/cjs/loader ', ' nativemodule VM ', ' Nativemodule internal/modules/cjs/helpers ', ' nativemodule console ', ' Binding tty_wrap ', ' N Ativemodule net ', ' Nativemodule internal/net ', ' binding cares_wrap ', ' binding stream_wrap ', ' B Inding tcp_wrap ', ' binding pipe_wrap ', ' nativemodule internal/stream_base_commons '], Binding: [Function : Binding], _linkedbinding: [function: _linkedbinding], _events: {newlistener: [function], removelist Ener: [function], warning: [function]}, _eventscount:3, _maxlisteners:undefined, _fatalexception: [F Unction], Domain:null, _exiting:false, assert: [function:deprecated], config: {target_defaults: [object], variables: [Object] }, Setuncaughtexceptioncapturecallback: [function], hasuncaughtexceptioncapturecallback: [function], Emitwarni     NG: [function], Nexttick: [Function:nexttick], _tickcallback: [function: _tickcallback], stdout: [Getter],  STDERR: [Getter], stdin: [Getter], Openstdin: [function], exit: [function], kill: [function], argv0: '/usr/local/bin/node ', mainmodule:module {id: '. ', exports: {}, Parent:null, file Name: '/users/00arunalldata00/009_mystudy/010_everest/001_everest4/20180628/201804/7.fs/11.fn.js ', Loaded: False, children: [], paths: [Array]}, Buffer: {[Function:buffer] poolsize:8192, from: [Func Tion:from], of: [Function:of], alloc: [Function:alloc], Allocunsafe: [Function:allocunsafe], Allocunsa Feslow: [Function:allocUnsafeslow], Isbuffer: [Function:isbuffer], compare: [Function:compare], isencoding: [Function:isencoding], Concat: [Function:concat], bytelength: [Function:bytelength], [Symbol (Kisencodingsymbol)]: [Function:isenc Oding]}, Clearimmediate: [Function:clearimmediate], clearinterval: [Function:clearinterval], clearTimeout: [Function : Cleartimeout], setimmediate: {[function:setimmediate] [Symbol (Util.promisify.custom)]: [Function]}, SetInterval: [Function:setinterval], setTimeout: {[Function:settimeout] [Symbol (Util.promisify.custom)]: [Function]}}object [GL Obal] {dtrace_net_server_connection: [function], dtrace_net_stream_end: [function], dtrace_http_server_request: [ Function], dtrace_http_server_response: [function], dtrace_http_client_request: [function], Dtrace_http_client_      RESPONSE: [Function], Global: [Circular], process:process {title: '/usr/local/bin/node ', version: ' v10.3.0 ', Versions: {http_parser: ' 2.8.0 ', node: ' 10.3.0 ', V8: ' 6.6.346.32-node.9 ', UV: ' 1.20.3 ', zlib: ' 1.2.11 ', Ares: ' 1.        14.0 ', modules: ' + ', NGHTTP2: ' 1.29.0 ', Napi: ' 3 ', OpenSSL: ' 1.1.0h ', ICU: ' 61.1 ',      Unicode: ' 10.0 ', Cldr: ' 33.0 ', tz: ' 2018c '}, Arch: ' x64 ', Platform: ' Darwin ', release: {Name: ' node ', sourceURL: ' https://nodejs.org/download/release/v10.3.0/node-v10.3.0.tar.gz ', Heade Rsurl: ' https://nodejs.org/download/release/v10.3.0/node-v10.3.0-headers.tar.gz '}, argv: ['/USR/LOCAL/C Ellar/node/10.3.0/bin/node ', '/users/00arunalldata00/009_mystudy/010_everest/001_everest4/20180628/201804/7.fs/ 11.fn.js '], execargv: [], env: {PATH: '/usr/local/opt/openssl/bin:/opt/vagrant/bin:/usr/local/sbin: /usr/local/opt/sqlite/bin:/usr/local/opt/openresty-openssl/bin:/usr/local/opt/icu4c/sbin:/usr/local/mysql/bin :/usr/local/opt/icu4c/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/applications/wireshark.app/contents/macos ', NVM_RC_VERSION: ', Force_color: ' True ', Electron_no_attach_console: ' True ', debug_colors: ' True ', Npm_config_color : ' Always ', mocha_colors: ' 1 ', versioner_python_version: ' 2.7 ', LOGNAME: ' Arunyang ', Nvm_nodej S_org_mirror: ' Https://nodejs.org/dist ', xpc_service_name: ' com.jetbrains.webstorm.77156 ', PWD: '/US  Ers/00arunalldata00/009_mystudy/010_everest/001_everest4/20180628/201804/7.fs ', NVM_CD_FLAGS: '-Q ', NVM_DIR:        '/USERS/ARUNYANG/.NVM ', SHELL: '/bin/zsh ', PAGER: ' Less ', lscolors: ' Gxfxcxdxbxegedabagacad ', Securitysessionid: ' 186a8 ', oldpwd: '/applications/webstorm.app/contents/bin ', versioner_python_prefer_32_b IT: ' No ', USER: ' Arunyang ', ZSH: '/users/arunyang/.oh-my-zsh ', TMPDIR: '/var/folders/wy/v0w9vkf52836x   21w_jz2wzlh0000gn/t/',     Ssh_auth_sock: '/private/tmp/com.apple.launchd.iktjc3zbdp/listeners ', xpc_flags: ' 0x0 ', nvm_iojs_org_mi Rror: ' Https://iojs.org/dist ', __cf_user_text_encoding: ' 0x1f5:0x0:0x0 ', Apple_pubsub_socket_render: '/priva     Te/tmp/com.apple.launchd.hubmuc0k3m/render ', Less: '-R ', Lc_ctype: ', HOME: '/users/arunyang '}, pid:3023, Features: {debug:false, uv:true, Ipv6:true, Tls_alpn:true, Tls_sni:     True, Tls_ocsp:true, tls:true}, ppid:2534, Execpath: '/usr/local/cellar/node/10.3.0/bin/node ',  debugport:9229, _startprofileridlenotifier: [Function: _startprofileridlenotifier], _stopprofileridlenotifier: [function: _stopprofileridlenotifier], _getactiverequests: [function: _getactiverequests], _getactivehandles: [Fu Nction: _getactivehandles], reallyexit: [Function:reallyexit], Abort: [Function:abort], chdir: [Function:ch DIR], CWD: [Function: CWD], umask: [Function:umask], Getuid: [Function:getuid], Geteuid: [Function:geteuid], setuid: [funct Ion:setuid], Seteuid: [Function:seteuid], setgid: [Function:setgid], Setegid: [Function:setegid], GETG ID: [Function:getgid], Getegid: [Function:getegid], getgroups: [Function:getgroups], setgroups: [Function: Setgroups], initgroups: [Function:initgroups], _kill: [function: _kill], _debugprocess: [function: _debugproc ESS], _debugend: [Function: _debugend], hrtime: [Function:hrtime], CPUUsage: [Function:cpuusage], Dlopen      : [Function:dlopen], uptime: [Function:uptime], memoryusage: [Function:memoryusage], _rawdebug: [Function], Moduleloadlist: [' Binding contextify ', ' nativemodule events ', ' Nativemodule internal/async_hooks '        , ' Nativemodule internal/errors ', ' binding uv ', ' binding buffer ', ' binding async_wrap ',      ' Binding config ',  ' Binding ICU ', ' nativemodule util ', ' nativemodule internal/encoding ', ' Nativemodule internal/util ', ' Binding constants ', ' binding util ', ' nativemodule internal/util/types ', ' internal Binding ty        pes ', ' nativemodule buffer ', ' nativemodule internal/buffer ', ' Nativemodule internal/process ',        ' Nativemodule assert ', ' nativemodule internal/assert ', ' Nativemodule fs ', ' Nativemodule path ', ' Nativemodule internal/constants ', ' Binding fs ', ' Nativemodule stream ', ' nativemodule internal/strea '        Ms/pipeline ', ' nativemodule internal/streams/end-of-stream ', ' Nativemodule internal/streams/legacy ', ' Nativemodule _stream_readable ', ' nativemodule internal/streams/buffer_list ', ' Nativemodule internal/streams /destroy ', ' nativemodule internal/streams/state ', ' nativemodule _stream_writable ', ' Nativemodule _str Eam_duplex ', ' NatIvemodule _stream_transform ', ' nativemodule _stream_passthrough ', ' Binding fs_event_wrap ', ' Nativemod Ule internal/fs/utils ', ' nativemodule internal/url ', ' nativemodule internal/querystring ', ' Binding ur '  L ', ' nativemodule internal/process/warning ', ' nativemodule internal/process/next_tick ', ' nativemodule        Internal/process/promises ', ' nativemodule internal/fixed_queue ', ' Nativemodule internal/process/stdio ', ' Binding performance ', ' Binding trace_events ', ' nativemodule internal/inspector_async_hook ', ' Bin        Ding Inspector ', ' Nativemodule timers ', ' Binding timer_wrap ', ' Nativemodule internal/linkedlist ', ' Nativemodule internal/timers ', ' nativemodule internal/modules/cjs/loader ', ' nativemodule vm ', ' N Ativemodule internal/modules/cjs/helpers ', ' nativemodule console ', ' Binding tty_wrap ', ' nativemodule Net ', ' NativemoduLe Internal/net ', ' binding cares_wrap ', ' binding stream_wrap ', ' binding tcp_wrap ', ' Binding pi ' Pe_wrap ', ' nativemodule internal/stream_base_commons '], binding: [Function:binding], _linkedbinding: [Fun Ction: _linkedbinding], _events: {newlistener: [function], RemoveListener: [function], warning: [F Unction]}, _eventscount:3, _maxlisteners:undefined, _fatalexception: [Function], Domain:null, _exi Ting:false, assert: [function:deprecated], config: {target_defaults: [object], variables: [Object]}, Setun Caughtexceptioncapturecallback: [function], hasuncaughtexceptioncapturecallback: [function], emitwarning: [Functio N], Nexttick: [Function:nexttick], _tickcallback: [Function: _tickcallback], stdout: [Getter], stderr: [G Etter], stdin: [Getter], Openstdin: [function], exit: [function], kill: [function], argv0: '/usr/local /bin/node ', MainmoduLe:module {id: '. ', exports: {}, Parent:null, filename: '/users/00arunalldata0 0/009_mystudy/010_everest/001_everest4/20180628/201804/7.fs/11.fn.js ', Loaded:false, Children: [], P      Aths: [Array]}, Buffer: {[Function:buffer] poolsize:8192, from: [Function:from], of: [Function:of],      Alloc: [Function:alloc], Allocunsafe: [Function:allocunsafe], Allocunsafeslow: [Function:allocunsafeslow],  Isbuffer: [Function:isbuffer], compare: [Function:compare], isencoding: [function:isencoding], concat: [Function:concat], bytelength: [Function:bytelength], [Symbol (Kisencodingsymbol)]: [Function:isencoding]}, C Learimmediate: [Function:clearimmediate], clearinterval: [Function:clearinterval], cleartimeout: [Function: Cleartimeout], setimmediate: {[function:setimmediate] [Symbol (Util.promisify.custom)]: [Function]}, setinterval: [F Unction:setinterval], SetTimeout: {[Function:settimeout] [Symbol (Util.promisify.custom)]: [Function]}}*/ 

  

012_call and Apply Differences

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.