Is there an easier way to use for-of
loop in Angular 9?
I had written code like this:
Object.keys(httpParams).forEach((key) => {
for (const paramKey of httpParams[key]) {
params = params.append(key, paramKey);
}
});
But are there some other ways not to use this for-of
loop
Object.entries(httpParams).forEach((data) => {
let key = data[0];
data[1].forEach((item)=> {
params=params.append(key, item);
});
});