Angular - TypeScript in Angular
Given this Angular generic service snippet:
What will be logged to the console?
export class DataService<T> {
private items: T[] = [];
add(item: T) { this.items.push(item); }
getAll(): T[] { return this.items; }
}
const service = new DataService<string>();
service.add('hello');
console.log(service.getAll());What will be logged to the console?
