Indexing means Google will decide if your page is worthy to be shown in search results. All the crawled pages have the chance to be indexed.
In the case of JavaScript, the Googlebot download the Java code and render it before extracting the links while in the case of HTML first, links are extracted and then crawled.