2026-05-24
Daily Tech Challenge
What does the `readonly` modifier do when applied to a class property in TypeScript?
class Point {
readonly x: number;
readonly y: number;
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
move(dx: number) {
this.x = this.x + dx; // Error here
}
}Sunday, May 24, 2026 · A new challenge drops every day