Here you can find a number of examples on Java Script.Please find the various kinds of examples listed on the right side of this site. If you don't find anything on Java Script then please write to us or leave a commnet. We are pleased to help and find the solution of your problem.

JavaScript: Shift Function



shift Function:
Removes the first element from an array and returns that element. This method changes the length of the array.

Syntax:
arrayname.shift()



Example in HEAD section:

<html>
<head>
<title>Shift Function</title>
<script language="javascript">
myArray = ["angel", "clown", "mandarin", "surgeon"];
document.writeln("myArray before: " + myArray + "<p>");
shifted = myArray.shift();
document.writeln("myArray after: " + myArray + "<p>");
document.writeln("Removed this element: " + shifted);
</script>
</head>
</html>


Example in BODY section:

<html>
<head>
<title>Shift Function</title>
</head>
<body>
<script language="javascript">
myArray = ["angel", "clown", "mandarin", "surgeon"];
document.writeln("myArray before: " + myArray + "<p>");
shifted = myArray.shift();
document.writeln("myArray after: " + myArray + "<p>");
document.writeln("Removed this element: " + shifted);
</script>
</body>
</html>




OUTPUT

myArray before: angel,clown,mandarin,surgeon

myArray after: clown,mandarin,surgeon

Removed this element: angel

13 comments:

  1. I go to see everyday a few blogs and blogs to read posts, but this weblog gives quality based writing.


    Look into my blog; Carry out organic treatment methods benefit moobs victims?

    ReplyDelete
  2. It's hard to find educated people about this topic, but you sound like you know what you're talking about!

    Thanks

    My page; categories Associated with Abnormality

    ReplyDelete
  3. Awesome site you have here but I was curious about if you knew of any discussion boards that
    cover the same topics discussed in this article?
    I'd really love to be a part of online community where I can get suggestions from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Appreciate it!

    Visit my web site; Carry out diet and also practice have a role inside management of gynecomastia?

    ReplyDelete
  4. Can you tell us more about this? I'd love to find out some additional information.

    My weblog: http://chestfatburner.com/all-you-need-to-know-about-man-boobs-treatment

    ReplyDelete
  5. Awesome blog you have here but I was wondering if you knew of any user discussion forums that cover the same topics talked about here?
    I'd really love to be a part of group where I can get advice from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Kudos!

    Have a look at my page :: jocuri online mmorpg

    ReplyDelete
  6. My partner and I stumbled over here by a different web address and thought I should check things out.

    I like what I see so now i am following you. Look forward
    to exploring your web page for a second time.

    my page :: Juegos Online

    ReplyDelete
  7. Good info. Lucky me I ran across your website by accident (stumbleupon).

    I've saved it for later!

    Review my homepage :: glume despre blonde

    ReplyDelete
  8. Wow, marvelous blog layout! How long have you
    been blogging for? you make blogging look easy. The overall look of your site is magnificent, as well as the
    content!

    Feel free to surf to my web site: Juegos Gratis

    ReplyDelete
  9. I'm curious to find out what blog platform you're utilizing?
    I'm having some minor security problems with my latest website and I would like to find something more safe. Do you have any recommendations?

    My webpage - Juegos Online

    ReplyDelete
  10. This design is incredible! You certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost.
    ..HaHa!) Excellent job. I really loved what you had to say, and more
    than that, how you presented it. Too cool!

    My web site ... jocurii aventura

    ReplyDelete
  11. It's perfect time to make some plans for the longer term and it's time to be happy.

    I've learn this put up and if I may I wish to counsel you few attention-grabbing things or advice. Maybe you could write subsequent articles regarding this article. I want to learn even more issues approximately it!

    Also visit my page bancuri geniale

    ReplyDelete
  12. Howdy I am so excited I found your weblog, I really found you by mistake, while I was searching on Google
    for something else, Anyhow I am here now and would just like to say
    thanks for a fantastic post and a all round thrilling blog (I also love the theme/design), I
    don’t have time to browse it all at the moment but I have bookmarked it and also
    added your RSS feeds, so when I have time I will be back to read more, Please do keep up the excellent b.


    Here is my blog post jocuri mmorpg online free

    ReplyDelete

Google