Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
JavaScript/JScript
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Arrays=== Arrays sind Objekte which can contain different objects. Arrays werden durch var arr = '''['''[( <Number> | <Element> {,<Element>})]'''];''' var arr = '''new Array('''[( <Number> | <Element> {,<Element>})]''');''' var arr = '''new Array<'''<TYPE>'''>(....)''' deklariert. In JavaScript, arrays always use numbered indexes. Die Indizierung ist 0-based. Arrays haben eine member variable '''length'''. JavaScript does not support associative arrays. If you use a named index, JavaScript will redefine the array to a standard object. After that, all array methods and properties will produce incorrect results. To empty an array you can: x.length = 0; // empties an existing array x = []; // creates a new array To delete an array element without leaving holes use: x.splice(<index>, <length of array section to delete>); ====Methoden der Array-Klasse==== =====push()===== adds an element at the end =====pop()===== removes the last element =====splice()===== splice(i,n) removes n elements starting at i =====shift()===== removes the first element =====unshift()===== The unshift() method adds new items to the beginning of an array, and returns the new length. var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.unshift("Lemon","Pineapple");
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width