I'm wonder what is difference between result.id and result['id'] in Angular/JavaScript ? If i'm type :
getId(){
this.service.getId().subscribe(
result=>{ var i = result.id; }//this...
)
}
...sometimes the compiler decorate result.id with red underline (error) then i change it to :
getId(){
this.service.getId().subscribe(
result=>{ var i = result['id']; }//with this
)
}
the decoration disappear. But sometimes i can write result.id and not see any errors.
Note that the result type is any !!!
So i'm confused a little with 2 cases. Did i miss something ?
Thanks anyway!