7

I can't find a complete syntax spec on the developer pages. I'm really wondering if there's an extended for loop ...

https://developers.google.com/apps-script/

I see the Default services, but that isn't defining what control flow syntax we can use. Is it precisely some version of JavaScript?

Sam Joseph
  • 4,584
  • 4
  • 31
  • 47
  • precisely can say the simpler version of javascript, it will control all google products like spresheet, forms and calendars from the backend like. – Viral Shah Sep 05 '12 at 10:30

2 Answers2

9

The GAS is not a precise version of JavaScript. It supports many features of JavaScript 1.8.5 like Object.keys, Object.isExtensible, etc. but on the other hand it does not support the keywords yield and let introduced in JavaScript 1.7. Another features which the GAS supports are the native JSON class and String.trim function introduced in JavaScript 1.8.1. Also the GAS supports the E4X extension.

The GAS documentation is not complete now and many features are discoverable experimentally.

megabyte1024
  • 8,482
  • 4
  • 30
  • 44
  • would be great if even the incomplete documentation could be made available - perhaps in wiki form so that community could contribute? Personally I'd love to see advanced for loops in there ... – Sam Joseph Sep 11 '12 at 10:20
  • 2
    You can rely on everything in 1.6 being there, which is extensively documented on the Mozilla Developer Network. We aren't planning on documenting the core language other than pointing people towards MDN. Our documentation (which is getting better constantly) is all about the extra Apps Script apis, and not JavaScript. That documentation is all available on https://developers.google.com/apps-script – Corey G Sep 27 '12 at 15:43
  • 1
    Thanks Corey, yes I've been to that link - would be nice if the precise subsections of JavaScript supported were described there, rather than just in this stackoverflow post :-) – Sam Joseph Oct 04 '12 at 09:18
  • 1
    what would be really nice would be if related stackoverflow posts hung off the individual elements of the GAS documentation, then we could very easily see what the community was saying about, and doing with, the different GAS features. The PHP and MySql documentation have long benefited from this, but I realize Google is unlikely to support anything like this soon. I asked the Android team if this was something they might include and was met with blank stares ... :-) I guess the attitude is you can, like, just search stackoverflow so that's enough right? – Sam Joseph Oct 04 '12 at 09:20
5

Apps Script is precisely JavaScript version 1.6

Corey G
  • 7,754
  • 1
  • 28
  • 28
  • 1
    @SamJoseph. To both of us :). The Corey's `precisely JavaScript version 1.6` sentence is true but his answer bounds only the lower version limit. My answer is also true and it specializes the top version limit. Our answers do not contradict with each other. – megabyte1024 Sep 24 '12 at 20:04
  • aha, thanks, makes sense, but can't mark both of you as correct - argh, er, logic breakdown ... either way would love to see even the partially complete documentation ... – Sam Joseph Sep 25 '12 at 14:13
  • 1
    I think it's safe to say that we are committed to 1.6 + E4X right now, and that when we do upgrade the engine it will be to an equal or greater version of JavaScript. Any speculative features of the current engine, aside from E4X which we have announced that we support, may or may not be preserved by an upgrade. Frankly I can't think of a single feature we support (again, aside from E4X) that hasn't been standardized in later versions, so this is extremely unlikely to ever be a problem for anyone. – Corey G Sep 27 '12 at 15:46
  • 1
    @CoreyG Where did you 'announce' E4X support? [link](https://developers.google.com/search/results?q=E4X&p=%2Fapps-script) no results here – Mesh Oct 26 '12 at 10:06
  • @CoreyG This is too improductive. Couldnt it be possible to list all features? – Malartre Aug 07 '14 at 15:04