Category : if-statement

I have an input form element. It has a default value MYVALUE. I would like to change this value when in focus. If there is any other value in there, I’d want to leave it unchanged. Here is my code: <input type="text" name="myInput" id="myInput" value="MYVALUE" style=" width:100%; font-size:1.2em; color:blue; " onclick=" if (document.getElementById(‘myInput’).value ===.’MYVALUE’;) { ..

Read more

I’m just starting javascript so I apologize if anything I say is unclear. I’m trying to write a function that see’s if the var emoji is the same as a specified emoji. I have an else statement following it – as a fall through. “` function match1() { var emoji = document.getElementById("emoji"); if (emoji == ..

Read more

public int payment(){ int Carpayment; int hour; String type; if (type == “MyVi”) Carpayment = 10 * hour; else if (type == “Iswara”) Carpayment = 15 * hour; else if (type == “Waja”) Carpayment = 20 * hour; else if (type == “Vios”) Carpayment = 25 * hour; else if (type == “Civic”) Carpayment = ..

Read more

I have a SPARQL query that holds certain properties. i want to return a table with these properties to which i can add a hyperlink to each value to redirect to a certain page. In particular, I want to do this when the value from the .map function matches the string "http://linkedbuildingdata.net/ifc/resources20201208_005325/". This is my ..

Read more

function charCheck(str) { if (str.length > 20 || str.length < 4 || str.indexOf(‘ ‘) >= 0) { document.getElementById("error1").innerHTML = ("Username must be between 4-20 characters long and must have no spaces.") } else { document.getElementById("error1").style.display = "none"; } } My code only shows the message only once after I trigger it, instead of being displayed ..

Read more

I’m trying to code a program that will loop through the elements of an array and check if they match a certain character pattern. The matching elements then get pushed onto a new array and the non-matching elements remain still. However I’m not getting the results I expected. This is my code: let firstArray = ..

Read more