---
title: "Copy array items into another array via JavaScript"  
description: "Copy array items into another array via JavaScript"  
author: "Anonymous User"  
published: 2021-07-20  
updated: 2021-07-20  
canonical: https://www.mindstick.com/forum/156576/copy-array-items-into-another-array-via-javascript  
category: "javascript"  
tags: ["javascript", "array"]  
reading_time: 2 minutes  

---

# Copy array items into another array via JavaScript

How to [copy](https://www.mindstick.com/forum/161993/explain-the-numpy-array-copy-vs-view-with-example) [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) [items](https://www.mindstick.com/forum/33812/getting-number-of-items-selected-in-uicollectionview-in-ios) into another array in [JavaScript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript)?

## Replies

### Reply by Anonymous User

The navigator.online property returns a boolean value either true or false, indicating whether the browser is in online mode or offline mode.

Syntax

navigator.onLine

Let's switch to the example for better understanding :

```
<!DOCTYPE html>
<html>
<head>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <style>
        html{
            scroll-behavior:smooth;
        }
        body {
            margin: 0;
            font-size: 28px;
            font-family: Arial, Helvetica, sans-serif;
        }
    </style>
</head>
<body>
    <div id='online_msg'>
        <div style='position: fixed; bottom: 0; background: #00D100; color: black; width: 100%; text-align: center; z-index: 9999;' id='check_connection'></div>
    </div>
    <script>
        function check_connection() {
            if (navigator.onLine) {
                document.getElementById('check_connection').innerHTML = 'Internet Connected';
                document.getElementById('check_connection').style.backgroundColor = '##00D100';
                document.getElementById('check_connection').style.color = 'black';
            }
            else {
                document.getElementById('check_connection').innerHTML = 'No Internet Connection';
                document.getElementById('check_connection').style.backgroundColor = 'red';
                document.getElementById('check_connection').style.color = 'white';
            }
        }
        setInterval(check_connection, 10);
    </script>
</body>
</html>
```

Hope this code will be helpful for you.

Happy Coding!


---

Original Source: https://www.mindstick.com/forum/156576/copy-array-items-into-another-array-via-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
