Question

need to create a whether or not the string hello is an item in that array. If hello is an item in the array, it should , hello
Programming, JavaScript
0 0
Add a comment Improve this question Transcribed image text
Answer #1

function findhello(userArray){
// loop through userArray for each element
for(var i=0;i<userArray.length;i++){
var item = userArray[i];
//if element equals hello return true
if(item == "hello"){
return true;
}
}
return false;
}
var list = ["mine","goodbye","hello"];
console.log(findhello(list));

Add a comment
Know the answer?
Add Answer to:
Programming, JavaScript need to create a whether or not the string "hello" is an item in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please use proper ES6 JAVASCRIPT SYNTAX including using Let & const correctly Create a function called...

    Please use proper ES6 JAVASCRIPT SYNTAX including using Let & const correctly Create a function called switchLetters that takes a string and an array. *the switchLetters function should accept two arguments , a string and an array. *The function switches letters in the string with a "/" if they are included in the array for example const arr = ['x', 'a', 'h', 'l', 'd' ] replaceLetters('hello', arr) //output: /e//o please do this in javascript es6 syntax

  • Write in C# Programming Language.   - count =0; - Create a 2d array "items". string[,] items...

    Write in C# Programming Language.   - count =0; - Create a 2d array "items". string[,] items = new string[100, 4]; - Create a do while loop, when user enter "0", stop the loop. - User enter item name, price, quantity, save these info and subtotal to array. - increase "count++" -conver price(decimal, Convert.ToDecimal() ) and quantity(int) to do mulplication for subtotal - create a for loop (with count ) to cycle through the "items", display item name, price, quantity, and...

  • Javascript question: Create an array with 4 elements in it. Make that array appear on the...

    Javascript question: Create an array with 4 elements in it. Make that array appear on the screen in the form of a list by using innerHTML. Add a form that will allow users to add a new item to the array. After the user submits their item, it should appear on the page with the other array items.

  • JavaScript Please Write a function that logs hello world if there is no argument provided. Otherwise,...

    JavaScript Please Write a function that logs hello world if there is no argument provided. Otherwise, it should log the argument provided (string) ex. greeting('JavaScript') => hello JavaScript.

  • Hello, Using HTML/Javascript, can somebody help me create an array and fill with random numbers 1-100,...

    Hello, Using HTML/Javascript, can somebody help me create an array and fill with random numbers 1-100, per the number entered in the "Create Array" box of my html, and have it display when the "Create Array" box is clicked? Here is the HTML for this portion: Thank you! <table style="width: 850px; height: 154px;" border="0"> <tbody> <tr> <td>Enter Array Size:<input style="width: 50px;" type="textbox" value="100" /><input type="button" value="Create Array" /></td> </tr> This is what the HTML looks like: Enter Array Size:100 Create...

  • Hello, I have my piece of C programming code and I have a pointer initialized to...

    Hello, I have my piece of C programming code and I have a pointer initialized to point to my array and I need help to display the contents of my array using a while loop or do-while loop. The stop condition should be when the pointer reaches '\0'. The code is below: #include <stdio.h> int main () {    char array[80]; printf("Enter a string: "); scanf("%[^\n]", &array); printf("%s\n", array); char * p;    p = array;         }

  • In this same program I need to create a new method called “int findItem(String[] shoppingList, String...

    In this same program I need to create a new method called “int findItem(String[] shoppingList, String item)” that takes an array of strings that is a shopping list and a string for an item name and searches through the “shoppingList” array for find if the “item” exists. If it does exist print a confirmation and return the item index. If the item does not exist in the array print a failure message and return -1. import java.util.Scanner; public class ShoppingList...

  • Can someone please help, third time I'm asking. I need a basic javascript with no push...

    Can someone please help, third time I'm asking. I need a basic javascript with no push or splice command. Please don't post a picture of the code,because my vision is poor and I won't be able to see it. Also, I need breakdown of what's in HTMLand what' s in javascript. All requirements are below. Thanks for your help. This is a 2 part assignment, but both parts can be completed in one program. Also, please follow ALL Required Programming...

  • In Javascript Define 2 functions in JSBin: - A function which receives an array of numbers...

    In Javascript Define 2 functions in JSBin: - A function which receives an array of numbers as an argument, and returns the product of all the numbers in that array.   For example, multiply([2,3,4]) should return 24. - A function which receives a string as an argument, and returns the reversal of that string.   For example, reverse('Hello there!') should return "!ereht olleH"

  • Hello I am taking an Introduction to Programming class and I need help coming up with...

    Hello I am taking an Introduction to Programming class and I need help coming up with a Psuedocode for an algorithm. Here is the assignment: 1. Use an array to prompt the user to enter a credit card account number 2. Use the sequential search algorithm to locate the credit card number entered by the user 3. If the credit card number is NOT in the array, display a message indicating the number is invalid 4. If the credit card...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT