Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6325095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:49:51+00:00 2026-05-24T16:49:51+00:00

I need to implement a hash table and hash function using JavaScript. The goal

  • 0

I need to implement a hash table and hash function using JavaScript.

The goal is to implement a FLASHCARD program for learning French.

For now, for each item I want to store 1)English word, 2)French word 3)a phrase example in French 4) the translation from French to English.

Possibly in the future it will also be necessary to consider images and other things.

For now my idea for hash table is the following:

var words = [['être', 'to be', 'Je suis professeur d’anglais', 'I am a English Teacher'], [, , , ], ...];

I was thinking a function like this.

var flashcards = (function () {
    var words = [['être','to be','Je suis professeur d’anglais','I am a English Teacher'],[,,,]];

    return function (n) {
        return words[n];
    };
}());
alert(flashcards(0)); // 'être, ....'

Please give me your suggestions regarding this code
and, above all, a efficient way to find elements in hash table.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:49:52+00:00Added an answer on May 24, 2026 at 4:49 pm

    First of all, that has nothing to do with a hash table. It’s just a 2d array 🙂 No hashing there, and you don’t need any either.

    I think you’d be better off making an object for the flash card so you can access properties by name. Then just make an array of that object:

    function FlashCard(){
        this.e_word = this.f_word = this.e_phrase = this.f_phrase = '';
        if(arguments[0])
            this.e_word = arguments[0];
        if(arguments[1])
            this.f_word = arguments[1];
        if(arguments[2])
            this.e_phrase = arguments[2];
        if(arguments[3])
            this.f_phrase = arguments[3];
    }
    
    var flash_cards = [
        new FlashCard('to be', 'être', 'I am an English Teacher', 'Je suis un professeur d’anglais'),
        new FlashCard('to have', 'avoir', 'I have three brothers', 'J\'ai trois frères'),
        new FlashCard('to want', 'vouloir', 'She wants to play soccer', 'Elle veut jouer au soccer')
    ];
    
    function random_card(){
        return flash_cards[Math.floor(Math.random()*flash_cards.length)];
    }
    
    var card = random_card();
    alert(card.e_word+': '+card.f_word);
    

    That should get you started: JSFiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My current implementation of an Hash Table is using Linear Probing and now I
I am using std::map to implement my local hash table, which will be accessed
I need to implement a 4-to-1 function in Veriog. The input is 4 bits,
I'm trying to implement a Chord distributed hash table. I want to use SHA-1
I never need to store objects in a hash table. The reason is twofold:
I've got a rather strange problem. For a Distributed Hash Table I need to
I need to implement RSA algorithm in Java. I've found the best solution using
I need to implement a Diff algorithm in VB.NET to find the changes between
I need to implement version control, even for just the developing I do at
I need to implement auto-capitalization inside of a Telerik RadEditor control on an ASPX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.