This is an old post, but I thought I should provide an illustrated answer anyway.
Use javascript’s object notation. Like so:
states_dictionary={ "CT":["alex","harry"], "AK":["liza","alex"], "TX":["fred", "harry"] };
And to access the values:
states_dictionary.AK[0] //which is liza
or you can use javascript literal object notation, whereby the keys not require to be in quotes:
states_dictionary={ CT:["alex","harry"], AK:["liza","alex"], TX:["fred", "harry"] };
Related Posts:
- Error OPTIONS net::ERR_CONNECTION_REFUSED
- Python to JavaScript converter
- Does JavaScript support array/list comprehensions like Python?
- Call Python function from JavaScript code
- Call python function from JS
- JSON.stringify (Javascript) and json.dumps (Python) not equivalent on a list?
- Separating html and JavaScript in Flask [duplicate]
- Parse the JavaScript returned from BeautifulSoup
- numpy division with RuntimeWarning: invalid value encountered in double_scalars
- WinError 2 The system cannot find the file specified (Python)
- How can I do a line break (line continuation)?
- Merging dataframes on index with pandas
- How to set environment variables in Python?
- hashlib.md5() TypeError: Unicode-objects must be encoded before hashing
- Sort array of objects by string property value
- Chrome sendrequest error: TypeError: Converting circular structure to JSON
- Importing modules from parent folder
- Could not find a version that satisfies the requirement tensorflow
- How do you change the size of figures drawn with Matplotlib?
- Python AttributeError: ‘str’ object has no attribute ‘decode’
- NameError: name ‘raw_input’ is not defined
- NPM ELIFECYCLE error – using node server.js command
- Is there a link to the “latest” jQuery library on Google APIs?
- Remove all whitespace in a string
- How do I correctly clone a JavaScript object?
- Pandas how to use pd.cut()
- What is the difference between list and list[:] in python?
- How to Read .txt in Pandas
- Mongoose – What does the exec function do?
- The tilde operator in Python
- Explain __dict__ attribute
- How to pretty print nested dictionaries?
- Is there a linked list predefined library in Python?
- return, return None, and no return at all?
- Developing an ad with MRAID.js
- What does [:-1] mean/do in python? [duplicate]
- ReferenceError: Invalid left-hand side in assignment
- How to detect Safari, Chrome, IE, Firefox and Opera browser?
- Javascript versioning to avoid caching, difference in these practices?
- Dictionary in a numpy array?
- Pythonic way to find maximum value and its index in a list?
- ReferenceError: document is not defined (in plain JavaScript)
- JavaScript innerHTML not updating element
- Palindrome check in Javascript
- Console is throwing Unterminated JSX contents error
- Console.log not working at all
- ‘pip install’ fails for every package (“Could not find a version that satisfies the requirement”) [duplicate]
- How to use Javascript to read local text file and read line by line?
- Why is the jquery script not working?
- Python Pandas ValueError Arrays Must be All Same Length
- Anaconda / Python: Change Anaconda Prompt User Path
- Pycharm and sys.argv arguments
- JQuery Datatables : Cannot read property ‘aDataSort’ of undefined
- includes() not working in all browsers
- ImportError: No module named ‘yaml’
- TypeError: ‘_io.TextIOWrapper’ object is not subscriptable
- super(type, obj): obj must be an instance or subtype of type
- What does “hashable” mean in Pytho
- Python multiprocessing.Pool: AttributeError
- Convert string to ASCII value python
- How to delete a specific line in a file?
- How does ajax work with python?
- RSA encryption and decryption in Python
- pip3 error – ‘_NamespacePath’ object has no attribute ‘sort’
- How to get current date in jQuery?
- What does {0} mean in this Python string?
- Tab Error in Python
- Print the contents of a DIV
- Installation of pygame with Anaconda
- Is there a Python equivalent of the C# null-coalescing operator?
- Remove all special characters except space from a string using JavaScript
- Python 3.6 import requests
- Tensorflow 2.0 – AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- How to Scroll Down – JQuery
- What is the meaning of “int(a[::-1])” in Python?
- Pandas unstack problems: ValueError: Index contains duplicate entries, cannot reshape
- How do I read image data from a URL in Python?
- Python: Convert timedelta to int in a dataframe
- Highlight a word with jQuery
- Can’t concat bytes to str
- How do I handle newlines in JSON?
- Invalid syntax when using “print”?
- Update style of a component onScroll in React.js
- Error loading MySQLdb module: No module named ‘MySQLdb’
- Unable to install boto3
- Fire oninput event with jQuery
- Reset Undo on the tinymce editor
- JavaScript in page doesn’t open new window [closed]
- wp_enqueue_script adds only the first script
- Dynamically insert values in a WordPress SelectControl Options field
- can a buttongroup have a label?
- Preloader for a WordPress Site
- Trying to integrate Zoho Campaign Form [closed]
- InnerBlocks restricting does not work on nested blocks
- Removing auto versioning of JS and loading to header
- Putting custom html/js page into Elementor as it’s own block
- Drag-to-Scroll Landingpage
- Update block once an API request returns with a value
- XMLHttpRequest of admin data to public
- Loaded JavaScript file not showing [duplicate]