Skip to content

Commit

Permalink
Update dilutionsworkboxsupereasy.js
Browse files Browse the repository at this point in the history
  • Loading branch information
avisilber88 authored Nov 10, 2023
1 parent 981dd63 commit d2a9296
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions dilutionsworkboxsupereasy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,33 @@ var givenAnswer;
var finalNum = 0;
var thisisanswer = 0;
var numberOfSigFigsToCount =0;

//beginning of the things to replace
var whatnameis = ""// prompt ("What is your name?");


var endSpace="";

var askagain = function (whatnameis){
whatnameis = prompt ("What is your full name (first and last)?");
whatnameis=whatnameis.replace(/\s+/g, ' ');
// console.error(whatnameis);
// console.log(whatnameis.slice(0, 1));
// alert("hello"+whatnameis);
if (whatnameis.slice(0, 1)==' '){
whatnameis=whatnameis.slice(1);
}
endSpace = whatnameis.slice(-1);
if (whatnameis.length<2){
askagain();
}
else if (!(/\s/.test(whatnameis))) {
// It has any kind of whitespace
askagain()
askagain();
}
else if(endSpace==" ") {
console.log("ends with space");
askagain();
}
else{
document.getElementById("nameis").innerHTML = whatnameis;
Expand Down Expand Up @@ -1119,4 +1136,4 @@ var roundTypeName;
//alert (thisAnswer);
alert (" You, "+whatnameis+" got a score of "+score + " on "+ m + " / " + d + " / " + y +" on app " + thisAppNum);
});
});
});

0 comments on commit d2a9296

Please sign in to comment.