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

  • Home
  • SEARCH
  • 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 6202367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:43:18+00:00 2026-05-24T04:43:18+00:00

From the below code one can discern that the function menu is called with

  • 0

From the below code one can discern that the function menu is called with three parameters.
From the menu function how could one get name or diff name depending on which had called menu?

var menus = {
    name: menu('Control', [
    {
        label: 'Public Class My Robot',
        trigger: true,
        script: 'public class MyRobot extends SimpleRobot\n{\n[[next]]\n}\n',
        helptext: "Beginning fo your program",
        depend: "package edu.team2648.frcEasyJ;"
    }], false),
    diffname: menu('Control2', [
    {
        label: 'Public Class My Robot',
        trigger: true,
        script: 'public class MyRobot extends SimpleRobot\n{\n[[next]]\n}\n',
        helptext: "Beginning fo your program",
        depend: "package edu.team2648.frcEasyJ;"
    }], false),
};

Also what kind of var is menus? (Array, Object,…?)
What is the difference between the following two snippets of code:

var test = ["str1","str2","str3","str4"];

var test2 = {id:"str1",id2:"str2",id3:"str3",id4:"str4"};
  • 1 1 Answer
  • 0 Views
  • 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-24T04:43:19+00:00Added an answer on May 24, 2026 at 4:43 am

    Since there are no associative arrays in JavaScript, you need to use objects if you want to assign key:val pairs and simulate the associative array functionality and reference behavior.

    var test = ["str1","str2","str3","str4"]; signifies a numerically-indexed array. We see the square brackets which groups the array, and we only see comma delimited values. If we wanted to access ‘str3’ we’d use test[2].

    var test2 = {id:"str1",id2:"str2",id3:"str3",id4:"str4"}; is an object. We see the curly braces which groups the object parameters, and we can see the key:val pairs split by the colon. If we want to access ‘str3’, we’d use test2.id3

    One thing that might be confusing to beginners is that objects can contain arrays and arrays can contain objects, so the square brackets and curly braces can be mixed in and not be immediately obvious. You can create an array through the Array object like var arr = new Array(). To keep things simple, segregate them and call them by their intended behavior: [] = array, and {} = object.

    In your example:

    var menus = {
        name: menu('Control', [
        {
            label: 'Public Class My Robot',
            ....
    

    You can see that menus is an object because it’s assigned to a curly brace. You can see that name is a key and menu('Control' is a value, which happens to be a function in this case. It’s first parameter is an obvious string, and it’s second is an array [] which only contains one value, which is an object {} which has key:val pairs – label being the key, and 'Public Class My Robot' being the value which is simply a string in this case.

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

Sidebar

Related Questions

Can any one help me convert the below code to LINQ? Select Catg,Count(*) From
I'm trying to get from Line #1 to Line #2 in the below code:
I have some really funky code. As you can see from the code below
The below code is from my other questions that I have asked here on
I wrote the below code to get a string (encrypted) from the user, and
I am using below code from one of my activity to start another Intent
tl;dr; Even without my explanation one can look at the code below and the
I got the code below from a tutorial that teaches how to make wordpress
I have get the date from excel sheet using POI using the below code,
The code below is from another SO post, and my question is can the

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.