From 250c4d47301d182904bf880762e667a54983f66d Mon Sep 17 00:00:00 2001 From: Mohamad Salman <139472418+MohamadSalman11@users.noreply.github.com> Date: Mon, 3 Mar 2025 18:56:58 +0100 Subject: [PATCH] fix(curriculum): add optional chaining to prevent "TypeError" in null checks (#59086) --- .../5efae0543cbd2bbdab94e333.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae0543cbd2bbdab94e333.md b/curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae0543cbd2bbdab94e333.md index 5c4b2d7bad4..c5d54b20120 100644 --- a/curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae0543cbd2bbdab94e333.md +++ b/curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5efae0543cbd2bbdab94e333.md @@ -45,12 +45,7 @@ The Cats `img` element should have an `alt` attribute with the value `Five cats ```js const catsImg = document.querySelectorAll('figure > img')[1]; -assert( - catsImg - .getAttribute('alt') - .replace(/\s+/g, ' ') - .match(/^Five cats looking around a field\.?$/i) -); +assert.match(catsImg?.getAttribute('alt')?.replace(/\s+/g, ' '), /^Five cats looking around a field\.?$/i); ``` # --seed--