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 8112855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:38:55+00:00 2026-06-06T02:38:55+00:00

Just when I think I’m getting an understanding of the syntax of Javascript, I

  • 0

Just when I think I’m getting an understanding of the syntax of Javascript, I run into something like this…

I saw this code on the jqPlot plugin page.

what kind of array is [[]] in javascript? A nested array? I thought I understood the double brackets, but in the commented text, I don’t understand why there is an extra set (question below).

$(document).ready(function(){
// Our data renderer function, returns an array of the form:
// [[[x1, sin(x1)], [x2, sin(x2)], ...]]
var sineRenderer = function() {
var data = [[]];
for (var i=0; i<13; i+=0.5) {
  data[0].push([i, Math.sin(i)]);
}
return data;
};

Why is there an extra set of brackets in this commented statement (the outermost set)?

[[[x1, sin(x1)], [x2, sin(x2)], ...]]

Thanks

  • 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-06-06T02:38:56+00:00Added an answer on June 6, 2026 at 2:38 am

    Since you are putting in arrays in your data array (which creates arrays inside an array), doing this would avoid that:

    var data = [];
    for (var i=0; i<13; i+=0.5) {
      data.push([i, Math.sin(i)]);
    }
    

    When you use [[]] and then do data[0], you are not utilizing outer array there which jumps in when you output it.

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

Sidebar

Related Questions

Best explained with code I think, this is just a simple example: public class
I've been thinking about this and I just can't think of a way to
I think this is just a Best Practices question, but I was wondering if
I think I'm just missing something simple here but here is what I am
[see later answer for more] I think this is just a simple rails question,
Really simple I just think it's me. this is file 1.php if(ctype_digit($_GET['id'])) { $item_id
I've tried searching for this a few times, but I just think I don't
This is probably something really simple but for some reason I just can't seem
just think that when I opened my file then when I want to write
I'm not very used to programming with flags, but I think I just found

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.