How to shift and unshift using JavaScript?
Submitted by: Administrator<script type="text/javascript">
var numbers = ["one", "two", "three", "four"];
numbers.unshift("zero");
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
</script>
This produces
zero one two
shift, unshift, push, and pop may be used on the same array in JavaScript. Queues are easily implemented using combinations.
Submitted by: Administrator
var numbers = ["one", "two", "three", "four"];
numbers.unshift("zero");
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
document.write(" "+numbers.shift());
</script>
This produces
zero one two
shift, unshift, push, and pop may be used on the same array in JavaScript. Queues are easily implemented using combinations.
Submitted by: Administrator
Read Online JavaScript Job Interview Questions And Answers
Top JavaScript Questions
☺ | Are you concerned that older browsers don't support JavaScript and thus exclude a set of Web users? individual users? |
☺ | What and where are the best JavaScript resources on the Web? |
☺ | How to make elements invisible? |
☺ | What Boolean operators does JavaScript support? |
☺ | How to change style on an element? |
Top Top World Wide Web Categories
☺ | Cascading Style Sheet CSS Interview Questions. |
☺ | HTML5 Interview Questions. |
☺ | Basic Internet Interview Questions. |
☺ | Domain Name System (DNS) Interview Questions. |
☺ | JavaScript Interview Questions. |