Skip to content

Commit

Permalink
Update rewritesigfigs.js
Browse files Browse the repository at this point in the history
  • Loading branch information
avisilber88 authored Nov 10, 2023
1 parent 3b6da3d commit 5ef0715
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions rewritesigfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,30 @@ $(document).ready(function(){

//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 @@ -423,4 +439,4 @@ thisAnswer=""+round(thisAnswer, 0);
//alert (thisAnswer);
alert (" You, "+whatnameis+" got a score of "+score + " on "+ m + " / " + d + " / " + y +" on app " + thisAppNum);
});
});
});

0 comments on commit 5ef0715

Please sign in to comment.