JSFiddle - React, Tailwind, and code Playground

JavaScript

//below you're given a function that will return a random number between 0 and 30. You're also given an array full of numbers. Your job is to write a function that will get a random number (use the function already written), then alert true if the number is found in the given array. If it's not found in the array, alert false

var getRandomArbitrary = function() {
  return Math.floor(Math.random() * (30 - 0) + 0);
}

var arr = [0,3,4,5,6,7,9,14,17,24,25,26,29,30];

//code here
var trueTest = function(thing){
    var i = getRandomArbitrary();
    console.log(i);
    var found = false;
    for(var j = 0; j<=thing.length; j++){
        if(i === thing[j]){
         found = true;
            break;
    }
  };
    alert(found);
    
};
trueTest(arr);

/**
 * Given an arbitrary input string, return the first nonrepeated character in
 * the string. For example:
 *
 *   firstNonRepeatedCharacter('ABA'); // => 'B'
 *   firstNonRepeatedCharacter('AABCABD'); // => 'C'
 */

var firstNonRepeatedCharacter = function(str) {
    var strLength = str.length;
    for(var i = 0; i < strLength; i++){
        var char = str.charAt(i)
        if(str.indexOf(char) === i && str.indexOf(char, i+1) === -1){
            return char;
}
    }
    return null
}
firstNonRepeatedCharacter("GGYRROO");