1

Where can I find a comprehensive dictionary of all the default javascript keywords and function/method/member names?

Some of the places I found:

  • I have Notepad++, so my first idea was to just extract all the auto-fill words from the javascript xml. It's what I have currently, but it's not comprehensive.
  • Then I remembered that Chrome's js console also has auto-fill, and it's certainly pretty comprehensive (it also includes user-defined stuff, but not on a completely blank page). The only problem is, how do I find where the default js setup for Chrome is cached?

Notes: I was also thinking, maybe there's a comprehensive online dictionary or something. Also, even if it's not a perfect csv of all the words, I can always write a quick filter program to properly format it. Lastly, it doesn't need to be so comprehensive as to include every word and every vendor-specific function/object name - it's mostly for personal use, and therefore isn't vital for it to be constantly accurate and up-to-date, etc.

Codesmith
  • 5,779
  • 5
  • 38
  • 50
  • Sounds like the wrong approach to me. What you can compress are *local* variable names and *module-scope* (not exposed) property names. Everything that is global or implements an interface which you don't control is incompressible. "keywords" or "common names" won't help you. – Bergi Jun 10 '13 at 20:07
  • 1
    Btw, why do you want to reinvent the wheel? Or is this just for learning purposes? – Bergi Jun 10 '13 at 20:08
  • making javascript as concise as possible, if I understand correctly, both optimizes and obfuscates code. I see it in popular libraries (e.g. JQuery). – Codesmith Jun 10 '13 at 21:20
  • @Bergi, I see what you're saying: I'm trying to _avoid_ compressing standard global variables/functions/objects etc. If I don't have a library of these keywords, my program will take them as user-defined - which *won't* work. – Codesmith Jun 10 '13 at 21:24
  • Shouldn't it work the other way round? Everything that is declared (as local [or global]) in one of the files is user-defined and the rest ist taken implicitly as global. – Bergi Jun 11 '13 at 01:41
  • The idea is to take arbitrary javascript code, find all user-defined names, and replace all occurences of each with a unique random group of upper and lowercase characters (that's not exactly how it works, but it's the idea). I can't be spending a ton of time logging every variable name, function, or object I create. – Codesmith Jun 11 '13 at 19:53
  • Why "log" every variable? They're in your code already. – Bergi Jun 12 '13 at 04:04
  • I'm not about to _parse_ complex javascript syntax _just_ to see what variables, functions, and objects are declared. Plus, what happens if I decide to declare a 'getElemenyById' in my own object? Then all other references get replaced, unless I go as far as parsing the javascript *scope*! I know what I'm doing, and I didn't provide the task so people would argue about it - I provide it to give a reason why what I'm asking for is relevant, and also to help narrow the scope of exactly what I'm looking for. – Codesmith Jun 12 '13 at 11:23
  • Well, if you're not doing it properly you better should not do it at all. Parsing the syntax (which is not *that* complex) is essential to the task, otherwise you won't be able to differentiate variable/property names and, say, string literals. Better choose an [existing solution](http://stackoverflow.com/questions/3520285/is-there-a-good-javascript-minifier) – Bergi Jun 12 '13 at 16:07
  • Listen: I'm doing this with php - so only basic is necessary; I'm skipping over strings, regular expressions, comments, and other wrappers - accounting for escape characters; all I need is a dictionary. That's my question; if you don't like it, don't bother answering it. – Codesmith Jun 12 '13 at 21:17

1 Answers1

1

The Mozilla Developer Network is a great place for JS documentation.

They have a greatly written wiki with thousands of articles for almostly everything, even some documentation for the upcoming ECMAScript 6.

See:

gustavohenke
  • 40,997
  • 14
  • 121
  • 129
  • 1
    There are also a few [reserved keywords](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words) that the above reference link doesn't have, so don't forget to look over these as well if you need to watch for keywords. – ajp15243 Jun 10 '13 at 19:29
  • It's referenced as the Appendix A – gustavohenke Jun 10 '13 at 19:32
  • I'm not so much looking for a _reference_ as I am just a list - This page would help if everything were listed on the page. That is, I don't see 'window', 'console', etc. – Codesmith Jun 10 '13 at 19:39
  • Thanks! I can use it, but it still doesn't seem to be ... _comprehensive_ - I'm still not seeing 'window' or 'console' – Codesmith Jun 10 '13 at 21:18
  • [Window](https://developer.mozilla.org/en-US/docs/Web/API/Window) is there, under HTML Interfaces. And `console` is a property of `window` in the browser, as well much other common things you could mention ;) – gustavohenke Jun 10 '13 at 22:08