This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaScript?????  RSS feed

 
Landon Blake
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was searching for information on arrays, which I thought could not be expanded once created. However, I found an article on "javascript" that talked about "growing" an array. Can the size of arrays be modified, and what is the difference between Java and JavaScript?
Thanks,
Landon
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is absolutely no connection between Java and JavaScript other than the name (JavaScript was called "LiveScript" up until the last minute before it was first release; the name was some marketing dude's idea.) JavaScript is a more or less object-oriented language, like Java, and the syntax is vaguely similar, but that's where the relationship ends.
You can "grow" a Java array using the Texas 3-step:
  • Allocate a new bigger array
  • Copy the old array's contents into it using System.arraycopy()
  • Assign the variable through which you accessed the old array to point to the new one.

  •  
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!