Get some basic browser data and return it as a JSON object

suggest change

The following function can be used to get some basic information about the current browser and return it in JSON format.

function getBrowserInfo() {
    var
        json = "[{",
        
        /* The array containing the browser info */
        info = [
            navigator.userAgent, // Get the User-agent
            navigator.cookieEnabled, // Checks whether cookies are enabled in browser
            navigator.appName, // Get the Name of Browser
            navigator.language,  // Get the Language of Browser
            navigator.appVersion,  // Get the Version of Browser
            navigator.platform  // Get the platform for which browser is compiled
        ],

        /* The array containing the browser info names */
        infoNames = [
                 "userAgent",
                 "cookiesEnabled",
                 "browserName",
                 "browserLang",
                 "browserVersion",
                 "browserPlatform"
        ];

    /* Creating the JSON object */
    for (var i = 0; i < info.length; i++) {
        if (i === info.length - 1) {
            json += '"' + infoNames[i] + '": "' + info[i] + '"';
        }
        else {
            json += '"' + infoNames[i] + '": "' + info[i] + '",';
        }
    };

    return json + "}]";
};

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Navigator Object:
* Get some basic browser data and return it as a JSON object

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
64 Console
68 Symbols
73 Modals
76 Events
84 Navigator Object
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde