@PrakashT 2020-02-14 08:30:47




for more clarification see this link

Now first index removed from your forecast array.

@Panda 2020-02-14 08:33:36

it replace the sunday to tuesday

@Panda 2020-02-14 08:35:08

{...friday},{...saturday}, {...sunday}, {...monday}, {...tuesday} output. but it remove the saturday to tuesday instead it will remove the friday

@Neji Soltani 2020-02-14 08:40:59

You should use splice

this.forecast.splice(0, 1)

where 0 is the index position and 1 the number of element to remove


list=["bar", "baz", "foo", "qux"]
list.splice(2, 1)
// Starting at index position 2, remove one element
["bar", "baz", "qux"]

@Panda 2020-02-14 08:39:34

return this.forecast.shift();

to remove the first weather in forecast.

you can use the shift() - method removes the first element from an array and returns that removed.


Related Questions

Sponsored Content

97 Answered Questions

[SOLVED] How can I remove a specific item from an array?

  • 2011-04-23 22:17:18
  • Walker
  • 7136675 View
  • 8649 Score
  • 97 Answer
  • Tags:   javascript arrays

59 Answered Questions

[SOLVED] How do I check if an element is hidden in jQuery?

46 Answered Questions

[SOLVED] How do I remove a property from a JavaScript object?

70 Answered Questions

[SOLVED] How to replace all occurrences of a string?

86 Answered Questions

[SOLVED] How do JavaScript closures work?

61 Answered Questions

[SOLVED] How do I include a JavaScript file in another JavaScript file?

39 Answered Questions

[SOLVED] How do I return the response from an asynchronous call?

94 Answered Questions

[SOLVED] How do I make the first letter of a string uppercase in JavaScript?

58 Answered Questions

[SOLVED] How do I redirect to another webpage?

3 Answered Questions

Sponsored Content