Skip to content

Commit 39c48f1

Browse files
Legal integer range
1 parent 83094f9 commit 39c48f1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Heap/js/methods.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ function setHeaderText(text) {
298298
}
299299
function setUpAddButton() {
300300
$("#addElem").click(function () {
301-
var val = prompt("Which value do you want to add? Integer >= 0. Maximum number of elements is 10");
302-
if (isNaN(parseInt(val)) || control.getArrayLength() >= 10) {
301+
var val = prompt("Which value do you want to add? Integer in the range 0-99. Maximum number of elements is 10");
302+
if (isNaN(parseInt(val)) || control.getArrayLength() >= 10 || parseInt(val) < 0 || parseInt(val) > 99) {
303303
return;
304304
}
305305
viewer.addNode(parseInt(val));

Heap/js/methods.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ function setHeaderText(text: string) {
342342

343343
function setUpAddButton() {
344344
$("#addElem").click(function () {
345-
let val = prompt("Which value do you want to add? Integer >= 0. Maximum number of elements is 10");
346-
if (isNaN(parseInt(val)) || control.getArrayLength() >= 10) {
345+
let val = prompt("Which value do you want to add? Integer in the range 0-99. Maximum number of elements is 10");
346+
if (isNaN(parseInt(val)) || control.getArrayLength() >= 10 || parseInt(val) < 0 || parseInt(val) > 99) {
347347
return;
348348
}
349349
viewer.addNode(parseInt(val));

0 commit comments

Comments
 (0)