Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method for js to change his own value?

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is the method of js changing self-value". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the method of js to change your self-value"?

The pop method removes the last element from the array and returns the value of that element.

Var array = ["cat", "dog", "cow", "chicken", "mouse"] var item = array.pop () console.log (array) / / ["cat", "dog", "cow", "chicken"] console.log (item) / / mouse

2. The push method adds one or more elements to the end of the array and returns the new length of the array.

Var array = ["football", "basketball", "badminton"] var I = array.push ("golfball") console.log (array) / / ["football", "basketball", "badminton", "golfball"] console.log (I) / / 4

3. The reverse method reverses the position of the elements in the array and returns the array.

Var array = var array2= array.reverse () console.log (array) / / [5Power4) / / console.log (array2===array) / / true Thank you for your reading. The above is the content of "what is the method for js to change its own value". After the study of this article, I believe you have a deeper understanding of what is the method of js to change your own value. The specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 260

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report