- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
09-01-2019 08:43 AM
Hi there,
I am wondering if there is a difference on using either one of them to reference a UDO variable in javascript extensions:
Tealiums documentation suggests to use the brackets notation like b['var_name'] fo example here:
https://docs.tealium.com/platforms/javascript/the-b-object/
While in the javascript extension itself, the editor suggests to use the dot notation:
Personally I currently stick to the brackets notation as from the documentation but i would prefere to use the dot notation for better readability in the future.
Cheers.
Solved! Go to Solution.
09-03-2019 01:47 AM
09-13-2019 12:46 AM - edited 09-13-2019 01:06 AM
Hi,
in TiQ, I'll use dot notation when I can (so I'd write your example b.var_name
). But many automatically generated names in TiQ include a dot, which forces you to use bracket notation: b["cp.cookie_name"]
.
That's more a technical consideration than a "best practice" I guess.
But I do agree that dot notation is easier to read, and doesn't risk dumb errors like omitting your quotes and accidentally referencing a variable instead of using a string literal.
Hope that's useful?
Best
Caleb
Copyright All Rights Reserved © 2008-2023