Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22049

Re: What's wrong with arguments.callee ?

Message-ID <5314301.3lsYH2pUt3@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-11-19 00:42 +0100
Subject Re: What's wrong with arguments.callee ?
Newsgroups comp.lang.javascript
References (3 earlier) <5957377.XgIPmTjdrt@PointedEars.de> <34f9ce58-665f-47db-a18e-f8c34197b9cf@googlegroups.com> <07194009-fe3b-40f4-a75b-769d330613ca@googlegroups.com> <ft91jfg53sty$.1a9stwne9lc9w.dlg@40tude.net> <8d52d023-3809-47b3-82c5-6fee6eff3734@googlegroups.com>

Show all headers | View raw


Michael Haufe (TNO) wrote:

> On Saturday, November 16, 2013 12:35:47 PM UTC-6, JJ wrote:
>> Sorry, I'm not quite good at English and can't understand which part
>> where data is leaked to G. Could you give a simple example code, please?
> 
> function f(x,y,z){
>     console.log([" x:",x," y:",y," z:",z].join(""))
>     g(arguments);
>     console.log([" x:",x," y:",y," z:",z].join(""))
> }
> 
> function g(args){
>     args[0] = "foo"
>     args[1] = "bar"
>     args[2] = args.callee
> }
> 
> f(1,2,3)

I think you have misplaced your spaces and semicolons.  Anyhow:

  function f (x, y, z)
  {
    "use strict";
  
    /* *x: 1, y: 2, z: 3" */
    console.log(["x: ", x, " y: ", y, " z: ", z].join(""));

    g(arguments);

    /* "x: 1, y: 2, z: 3" */
    console.log(["x: ", x, " y: ", y, " z: ", z].join(""));
  }
  
  function g (args)
  {
    args[0] = "foo"
    args[1] = "bar"
    // args[2] = args.callee
  }
  
  f(1, 2, 3);

Therefore, it was _not_ necessary to forbid arguments.callee in strict mode.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: What's wrong with arguments.callee ? aljey1972@gmail.com - 2013-11-15 00:20 -0800
  Re: What's wrong with arguments.callee ? Ry Nohryb <jorge@jorgechamorro.com> - 2013-11-15 01:05 -0800
  Re: What's wrong with arguments.callee ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-11-15 06:25 -0800
    Re: What's wrong with arguments.callee ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-15 16:25 +0100
      Re: What's wrong with arguments.callee ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-11-15 09:50 -0800
        Re: What's wrong with arguments.callee ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-11-15 21:15 -0800
          Re: What's wrong with arguments.callee ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-16 11:31 +0000
          Re: What's wrong with arguments.callee ? JJ <duh@nah.meh> - 2013-11-17 01:35 +0700
            Re: What's wrong with arguments.callee ? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-11-17 11:34 -0800
              Re: What's wrong with arguments.callee ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-19 00:42 +0100

csiph-web