You only declare obj
, but you don’t initialize it.
Change
var obj: Uni;
obj.uniName = responseData[i].UniversityNameOfUser;
to
let obj: Uni = { uniName: responseData[i].UniversityNameOfUser };
Note:
Avoid using var
. Use const
(immutable) or let
(mutable) instead.
solved What is the reason of this error? How do I solve this? [closed]