Skip to content

Arguments object scope not maintained within inner functions when using function shorthand () #10476

@jdalrymple

Description

@jdalrymple

Version: 7.3.0, 6.4.0, 4.0.0 (Just tested these three)
Platform:

  1. Linux 4.8.13-1-ARCH deps: update openssl to 1.0.1j #1 SMP PREEMPT x86_64 GNU/Linux
  2. Also tested in Chrome 55.0.2883.75 (64-bit)
function test(){
  this['fake'] = () =>{
	console.log(arguments)
  }
}

var a = new test('a');

a.fake('dummyArguments')

=> 'a'

Shouldnt this return 'dummyArguments' since the arguments object is scoped http://stackoverflow.com/questions/29216881/inner-function-scope-in-javascript

Where as when not using the function shorthand:

function test(){
  this['fake'] = function() {
	console.log(arguments)
  }
}

var a = new test('a');

a.fake('dummyArguments')

=> 'dummyArguments'

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions