Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
var input = message.content.toUpperCase();
if(input.indexOf("!")
{
bot.sendMessage(message, "!!!");
}
Help would be great, also earlier input was defined earlier
The String#indexOf method returns the index if found else returns -1. In your case .indexOf("!") return 0 and it's a false value and if statement never gets executed,so update your condition based on that.
if(input.indexOf("!") > -1)
or
if(input.indexOf("!") != -1)
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
Below is a small code snippet. Can't really understand what mistake I am making, but two false when ORed (||) is resulting into true. Can someone help me please?
Here is the code:
let result = {isVerified: 'verified'}
console.log(result.isVerified, !result.isVerified, result.isVerified !== 'verified', ((!result.isVerified) || (result.isverified !== 'verified')));
I am using node version v14.16.1
try using this code
You have writen isVerified as isverified
let result = { isVerified: "verified" };
console.log(
result.isVerified,
!result.isVerified,
result.isVerified !== "verified",
!result.isVerified || result.isVerified !== "verified"
);
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I'm trying to make an alert, that prints the value of a variabile, here is my attempt.
var username = prompt("I'm LaunchBot, what's your name?");
var print = alert() ;
alert() is a function. It take a parameter between the parenthesis. So just insert your variable username between them:
var username = prompt("I'm LaunchBot, what's your name?");
alert(username) ;
As suggested in the comment alert() doesn't return anything so do not add a variable assignment before.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
This is happening on an angular application I'm building. If a user enters 80 into an HTML input, it always seems to get this comparison wrong.
var x = '80';
var y = 150.9800;
/* Returns incorrect answer */
if (parceFloat(x) < y) {
return true;
} else {
return false;
}
You need to use ParseFloat() not parceFloat() ...
parceFloat is not an existing function.
parceFloat() is not a function, the function is parseFloat()
A simple typo is all the error there is.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have a list of li tags in an unordered list and each li has an attribute called data-clicked=false. this if... else if... statement will test to see if data-clicked==true/false and then give an alert with the value of the attribute. The problem is that this is always alerting "true" when it should be "false" since by default at the start they are all set to false.
$("ul").click(function(event) {
if ($(event.target).data("clicked"==true)) {
alert("true")
}
else if ($(event.target).data("clicked"==false)) {
alert("false")
}
});
basically all I want to know is how I can test to see if the data-clicked attribute is true or false.
your condition
if ($(event.target).data("clicked"==true)) {
wont work. It should be
if ($(event.target).data("clicked")==true) {
and same would be the case for the else if part
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
So, I have the script below and it successfully checks the values of the inputs when I click on a div with onclick="checkInputs()" inside.
But when I click the div again, it doesn't run the code. would I have to put return false; after it?
function checkInputs() {
if (document.getElementById("emailAdressInput").Value === "ADRESSHERE" && document.getElementById("passwordInput").Value === "PassHere")
{
document.getElementById("notifier").innerHTML = "Login Successful!";
}
else
{
document.getElementById("notifier").innerHTML = "Login Unsuccessful.";
}
}
To get the value of element you should use value not Value
document.getElementById("passwordInput").value
instead of
document.getElementById("passwordInput").Value;
UPDATE
Here is your working DEMO
The strict operator === checks for type also, If you put passHere instead of PassHere it reurns false.