fixed bugs
This commit is contained in:
1 parent
4b97a2b147
commit
ab6e7d323b
2 files changed
+9
-2
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";
|
import {average} from "https://cdn.jsdelivr.net/gh/didiercrunch/cours-420-301-ah@main/modules-examples/stats.js";
|
||||||
|
|
||||||
|
)( ) ()( )
|
||||||
|
|
||||||
|
|
||||||
function sayHello(){
|
function sayHello(){
|
||||||
alert(average([10, 67, 82, 109]));
|
alert(average([10, 67, 82, 109]));
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export function isValidIsbn13(str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
check = (10 - (sum % 10)) % 10;
|
check = (10 - (sum % 10)) % 10;
|
||||||
return (check === str[str.length - 1]);
|
return (check.toString() === str[str.length - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isValidIsbn10(str) {
|
export function isValidIsbn10(str) {
|
||||||
@@ -38,7 +38,7 @@ export function isValidIsbn10(str) {
|
|||||||
if (check === 10) {
|
if (check === 10) {
|
||||||
check = 'X';
|
check = 'X';
|
||||||
}
|
}
|
||||||
return (check === str[str.length - 1].toUpperCase());
|
return (check.toString() === str[str.length - 1].toUpperCase());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,3 +46,8 @@ export function isValidIsbn10(str) {
|
|||||||
export function isValidIsbn(str) {
|
export function isValidIsbn(str) {
|
||||||
return isValidIsbn13(str) || isValidIsbn10(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