fixed bugs
This commit is contained in:
1 parent
4b97a2b147
commit
ab6e7d323b
2 files changed
+10
-3
No files matched your search
@@ -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]));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(isValidIsbn("ahs"))
|
||||
console.log(isValidIsbn("0-7754-2153-7"))
|
||||
console.log(isValidIsbn("978-5-0583-5600-2"))
|
||||
|
||||
Reference in new issue
Block a user