I want to declare multiple baseUrl here to a single variable for my User Search Bar -
const baseUrl =
host/user/phoneandhost/user/email
You can also use object to store multiple url in same variable, based on type or purpose
const baseUrl = {
phone: 'host/user/phone',
email: 'host/user/email'
}
getUrl(type: string = 'email') {
return baseUrl[type];
}
You can use an array and iterate over all fields when working with the values
const baseUrls = ['host/user/phone', 'host/user/email'];
for (const baseUrl of baseUrls) {
// ...
}
patel shraddha
Software Developer @iFour Technolab Pvt Ltd
string url =['host:8082/user/phone' , 'host:8082/user/email'];