- // Author: Arda Basoglu, [email protected]
- // This example demonstrates the use of map like (like hash map in Java and dictionary in C#) data structure
- // The code is tested with a machine Node.js installed
- // If you have Node.js installed on your machine run the script by writing "node map.example.js" on the console
- // create a map
- var map = {};
- // Add key, value pairs into the map with random strings
- for (var i = 0; i < 500; i++) {
- var item =generateRandomString();
- var value = generateRandomString();
- map[item] = value;
- };
- // Output every key, value pair onto the screen
- for (var i in map) {
- }
- // The function required for generating random strings
- function generateRandomString()
- {
- var randomString = "";
- var randomStringSource = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- for( var i=0; i < 5; i++ ){
- }
- return randomString;
- }
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorArda Basoglu is a digital marketing agency owner, software engineer/developer, musician. Worked for several companies: TWB, BNB Software, PINC Solutions, hakia, Nurol, NTV. Archives
October 2023
Categories
All
|