To use the assign function from the lodash library in Typescript, we need to import the lodash library and assign function.
index.ts162 chars9 lines
In the above example, we imported the entire lodash library as _
. We then created two objects, obj1
and obj2
. Finally, we used the _.assign()
function to merge the two objects and store the result in result
.
Note: If there are properties with the same name in both obj1
and obj2
, the value from obj2
will overwrite the value in obj1
.
gistlibby LogSnag