`What is the most concise and efficient way to find out if a JavaScript array contains a value?  This is the only way I know to do it:  function contains(a, obj) {     for (var i = 0; i < a.length; i++) {         if (a[i] === obj) {             r...`
`Is the runtime complexity defined by the JS standard on common Array functions like push, pop, shift, slice or splice? Esp. I'm interested in removing and inserting entries at random positions. If the complexity is not defined, what can I expec...`
`If I remove one element from an array using splice() like so:  arr.splice(i, 1);   Will this be O(n) in the worst case because it shifts all the elements after i? Or is it constant time, with some linked list magic underneath?...`
`In some of the projects I'm working on as part of my day job, I need to access data in very large JS objects (on the order of thousands of key-value pairs). I'm trying to improve the efficiency of my code, so I came up with a few questions:...`
`I have the following JavaScript on my site so that when certain specific searches are performed, the answer is hardcoded to a specific page:  function redirect() {     var input = document.getElementById('searchBox').value.toLowerCase();...`
`My function should return the missing element in a given array range. So i first sorted the array and checked if the difference between i and i+1 is not equal to 1, i'm returning the missing element.  // Given an array A such that: // A = 2 //...`
`This question already has answers here:...`
`I have a problem which requires a string to be transformed into another one by appending copies of its' initial value to itself. The problem allows to remove single characters at some places.  Explanation  let x = "abba"; // First string...`
`I am considering using JavaScript object as a dictionary.      var dict = {}     dict['a'] = 1;     dict['b'] = 2;      var my_first = dict['a'];   I am not clear about the time-complexity of such implementation. Is it like ha...`
`I have an array like this   students = [{name: 'Abbey', age: 25}, {name: 'Brian', age: 45},             {name: 'Colin', age: 25}, {name: 'Dan', age: 78}]   and I want the output to be;  uniqueAges = [45, 78]   To be cl...`