
Dealing with Arrays in javascript
Hello, hivers. I'm here to give a detailed explanation on how to get an item by index number, and also delete an item on the list.
Alright, let's begin.
Example
An Array can have different values
String = "Hive",
Number = 2
Object = {post},
Boolean = True/False
{"hiveBlog":[ "Post", "proposals", "witnesses", "dApps" ]}
when trying to access the list of items in the array, one could use
x =Object.hiveblog
Note: list of items in an array are been numbered from zero index upwards, For Example
[ "Post", "proposals", "witnesses", "dApps" ]
0 = post,
1 = proposals
2 = witnesses
3 = dApps
So when accessing the items individually one can use
x =Object.hiveblog[0]
The above result would be = post
While also when trying to access the last item on the array it's going to be
x =Object.hiveblog[3]
which is = dApps
To delete among the list of items in the array one can use
delete Object.hiveBlog[1];
Which is going to remove proposals from the list
stay tuned, more to come concerning arrays
Leave Dealing with Arrays in javascript to:
Read more #html posts
Best Posts From suleimanz
We have not curated any of suleimanz's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From suleimanz
- Dealing with Arrays in javascript
- Creating a Simple table with HTML only
- Creating and styling a button
- Creating a header in html
- What to know before my first programming Tutorial
- My first post on Hive Blog
- Necessary change needed in Essential launcher
- Bug Detected in SocialChat app login page
- Bug detected on Kolab Notes
- PocketMaps app Automatically crashes while opening it