Interpolation of an unset value prints "undefined"
See original GitHub issueHello. While trying to implement value prefilling for my inputs I encountered many “undefined” values for unset variables.
Steps to reproduce:
- Go to interactive examples https://eta.js.org/docs/examples/interactive
- Change
Eta.render('Hi <%= it.name %>', {name: 'Person'})
toEta.render('Hi <%= it.name %>', {})
- Press Run button. Result is “Hi undefined”.
It is very inconvenient to use something like <%= it.name || “” %> for each interpolation especially for input prefilling. So I think showing “” instead of “undefined” is more correct. EJS thinks the same way and renders "Hi " if I modify this example for it. However if it is intended and there is another way to interpolate undefined values as “” please add it to the documentation.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
php - Why string interpolation throws Undefined property
When I use string interpolation in Dog class to acess a method in Animal class, ... public function setName($value) { $this->name=$value; ...
Read more >Why isn't string interpolation working? (Check for backticks)
It just prints the literal characters ${myName} without reading them as a variable. It seems to be bugged. If I type it, the...
Read more >Interpolation technique used in numpy - Math Stack Exchange
In fact, you even have a repeated value with different corresponding fp values! In this case, the behavior is undefined.
Read more >Template Designer Documentation - Jinja
for Expressions to print to the template output ... If a variable or attribute does not exist, you will get back an undefined...
Read more >10.2. Parameter Substitution
Once again: variable= # variable has been declared, but is set to null. echo "${variable-0}" # (no output) echo "${variable:-1}" # 1 #...
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
Thank you! Everything works great, no more “undefined”.
Yes, even better! Good thinking 👍