Modify object
See original GitHub issueHello
Let’s imagine we’re having an object:
{% set object = {
title: 'title',
content: 'content'
} %}
Is there any way to modify it’s properties without overriding whole object?
For example, like:
{% set object.title = 'New title' %}
or to add another key:
{% set object.test = 'New key value' %}
Currently such attempts will return error TypeError: Cannot call method 'charAt' of undefined
, of course.
Now I wonder, is there any workaroud for it, or it isn’t possible and won’t be ever possible too?
If I do understand it right, jinja has such possibility, with do
block
http://stackoverflow.com/questions/11047886/modifying-dictionary-attributes-in-jinja2
Issue Analytics
- State:
- Created 9 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Modifying Objects | Intro to JS: Drawing & Animation | Computing
Pamela shows how to modify objects while your program is running, to change existing properties or add new ones. Created by pamela ❤....
Read more >How To Add, Modify and Delete JavaScript Object Literal ...
How To Add, Modify and Delete JavaScript Object Literal Properties · Add property to an Object: · Delete property from an Object: ·...
Read more >Understanding Objects in JavaScript - DigitalOcean
In this tutorial, we will review how to create an object, what object properties and methods are, and how to access, add, delete,...
Read more >Modify Objects - CustomGuide
1. Select an object. 2. Click Edit on the menu bar. 3. Select Copy.
Read more >Modifying Object Properties - L3HarrisGeospatial.com
Modifying Object Properties ... Some IDL objects have properties associated with them; things like color, line style, size, and so on. You can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This looks simpler and sufficient for this case:
Usage
… prints “123” as expected.
@jan-dolejsi the output is correct. You’ve set
key2
to123
, and it prints123
afterward. What did you expect?