Given:
var x = {
myproperty: 'my value'
};
You can access the value by:
var value = x['myproperty'];
If you’re looking for a global variable, then you would check its container (window
);
var value = window['x']['myproperty'];
More Related Contents:
- Preserve browser window aspect ratio while shrinking [closed]
- Remove element from JS injected HTML
- Format number to always show 2 decimal places
- Is it bad practice to have a constructor function return a Promise?
- how to get GET and POST variables with JQuery?
- How to use underscore.js as a template engine?
- Convert character to ASCII code in JavaScript
- typeof !== “undefined” vs. != null
- How to scroll to top of page with JavaScript/jQuery?
- JavaScript getter for all properties
- Contexts and methods for communication between the browser action, background scripts, and content scripts of chrome extensions?
- How to use jQuery to select a dropdown option?
- Does using $this instead of $(this) provide a performance enhancement?
- What is the purpose of new Boolean() in Javascript?
- Cannot access cssRules from local css file in Chrome 64
- Add commas or spaces to group every three digits
- Does extension messaging like chrome.runtime.sendMessage internally use JSON.stringify?
- new Image(), how to know if image 100% loaded or not?
- How to remove backslash escaping from a javascript var?
- Detect input value change with MutationObserver
- How to print React component on click of a button?
- Group by and calculate mean / average of properties in a Javascript array
- How to correctly use axios params with arrays
- HTML5 video javascript controls – restart video
- Is there a limit on the size of a string in JSON with Node.js?
- Reload the site when reached via browsers back button
- Close a SELECT dropdown list programmatically with Javascript/jQuery
- Removing backslashes from strings in javascript
- Possible to reverse a css animation on class removal?
- Approach to multiple MySQL queries with Node.js