Hi .. i have creaated this code but my task is to make this program bellow so that it disregards upper and lower case letters. can anyone please help im stuck with my assignment
// Create a variable to store the amount of goes left and start it off containing 11
var goesleft = 11;
// Define an array with a list of words
var words = ["practical","programming","software","developm ent"];
// Generate a random number between 0 and the length of the array and put it into a variable
var randomnumber=Math.floor(Math.random()*words.length );
// Get the element of the array at the position of the random number and put it into a variable
var currentword = words[randomnumber];
// create a variable to hold the placeholder
var placeholder = "";
// repeat for each letter in the current word
for (var i = 0; i < currentword.length; i++)
{
// each repetition, add - to the placeholder variable
placeholder += "-";
}
// Repeat the following steps while the number of goes is > 0
while (goesleft > 0)
{
// Print the placeholder
println(placeholder);
// Create a variable to hold the user's guess
// ...and put user's input into it
var guess = input("Enter your guess!");
// this gets set if there's a match
var match = 0;
// Repeat for each letter in the "current word" variable
for (var i=0; i < currentword.length; i++)
{
// if this letter in the "current word" is the same as the guess replace the dash in the placeholder
if (currentword.substr(i,1) == guess)
{
placeholder = placeholder.substring(0, i) + guess + placeholder.substring(i+1);
match = 1;
}
}
// If none of the letters match, decrement the number of goes
if (match == 0)
{
goesleft--;
}
// If there are no dashes left in the placeholder, make the number of goes 0 (because they've won)
if (placeholder.indexOf("-") == -1)
{
goesleft = 0;
}
}
println("End of game!");
println("The word was "+currentword);