Am I using setTimeout in an inefficient manner?

Am I using setTimeout in an inefficient manner?

I have an angular app and I want to implement a 'Time Ago' feature. If I render some crazy number of 'questions', would this be a bad idea?

I have an angular app and I want to implement a 'Time Ago' feature. If I render some crazy number of 'questions', would this be a bad idea?

If you can imagine a facebook post that says 'posted about a minute ago...', that's what I'm shooting for.

The assumption is that the user never refreshed the page and the questions are appended to the angular mdoel from a signlar hub

export interface IQuestion {
  timeAgo: string;
}

export class Question implements IQuestion { public timeAgo: string; constructor(question: IQuestion) { this.timeAgoTicker(); } timeAgoTicker(): void { this.timeAgo = 'just now'; setTimeout( () => this.timeAgo = 'about a minute ago', 10000); setTimeout( () => this.timeAgo = 'a couple of minutes ago', 20000); setTimeout( () => this.timeAgo = '5 minutes ago', 50000); // etc... } }


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

An Angular Roadmap — The Past, Present, and Future of Angular

✅Interested in being an Angular developer in 2019? ... blog post it's most likely that you've written some code in javaScript in the past.