From ab6e7d323b8f9e15e8a246f936f5416c44cbcaa4 Mon Sep 17 00:00:00 2001 From: didier amyot Date: Sat, 2 Dec 2023 10:14:25 -0500 Subject: [PATCH] fixed bugs --- modules-demo/script.js | 2 ++ modules-examples/books.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules-demo/script.js b/modules-demo/script.js index 6204b1f..3ba2821 100644 --- a/modules-demo/script.js +++ b/modules-demo/script.js @@ -1,5 +1,7 @@ import {average} from "https://cdn.jsdelivr.net/gh/didiercrunch/cours-420-301-ah@main/modules-examples/stats.js"; +)( ) ()( ) + function sayHello(){ alert(average([10, 67, 82, 109])); diff --git a/modules-examples/books.js b/modules-examples/books.js index 6f78ebd..b27e074 100644 --- a/modules-examples/books.js +++ b/modules-examples/books.js @@ -16,7 +16,7 @@ export function isValidIsbn13(str) { } } check = (10 - (sum % 10)) % 10; - return (check === str[str.length - 1]); + return (check.toString() === str[str.length - 1]); } export function isValidIsbn10(str) { @@ -38,11 +38,16 @@ export function isValidIsbn10(str) { if (check === 10) { check = 'X'; } - return (check === str[str.length - 1].toUpperCase()); + return (check.toString() === str[str.length - 1].toUpperCase()); } export function isValidIsbn(str) { return isValidIsbn13(str) || isValidIsbn10(str); -} \ No newline at end of file +} + +console.log(isValidIsbn("ahs")) +console.log(isValidIsbn("0-7754-2153-7")) +console.log(isValidIsbn("978-5-0583-5600-2")) +