3 Replies Latest reply on Sep 30, 2017 2:58 PM by Jarda Bereza

    What does "new" do?

    Silver Back Gorilla Level 1

      A lot of code snippets I find seem to have "new" in it. I'm trying to figure out exactly what it does. I've been googling and can't seem to really figure it out. I've tested a lot of things with and without "new" and it doesn't seem to make a difference. For example, these to lines of code both work with or without "new". So is "new" really needed and if so why?

       

      app.activeDocument.activeLayer.translate(new UnitValue(1000,'px'),new UnitValue(1000,'px'));
      app.activeDocument.activeLayer.translate(UnitValue(1000,'px'),UnitValue(1000,'px'));