Front-End Javascript question (no espocrm)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • item
    Active Community Member
    • Mar 2017
    • 1476

    Front-End Javascript question (no espocrm)

    Hi,
    what do that mean ?

    PHP Code:
    attributes['assignedUserId'] = [model.get('assignedUserId')]
    attributes['assignedUserName'] = [model.get('assignedUserName')]
    Ok : atttibutes is a array

    Not understand = [ .... ] , why model.get('assignedUserId') is under 2 bracket ?
    and why not ; at the end of line ?

    Why not :
    attributes['assignedUserId'] = model.get('assignedUserId') \*with at end*\ ;

    Just for my knowledge.



    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​
  • yuri
    Member
    • Mar 2014
    • 8453

    #2
    This is the same as:

    Code:
    const list = [];
    list.push(model.get('assignedUserId'));
    attributes['assignedUserId'] = list;
    But the code snipped does not make sense in the Espo context. As assignedUserId is always string or null, not an array.

    Semicolon is not mandatory is javascript.
    Last edited by yuri; 11-22-2023, 11:45 AM.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...