Why does tizen.js use "new array()" with lowercase 'a' instead of "new Array()"?

Original Created Mar 07, 2017 | Regeneration Apr 22, 2026

I noticed that in tizen.js, there's a function called "new array()" written with a lowercase 'a' instead of the standard "new Array()". For example:

AlarmAbsolute.prototype.daysOfTheWeek = new array();

This results in an error:

ReferenceError: Can not find variable: array

Why would the code use "new array()" instead of the correct "new Array()" syntax?

Problem Understanding

The issue arises from using incorrect JavaScript syntax. In JavaScript, array constructors must be called with Array (capital A) rather than array (lowercase a). The JavaScript engine is case-sensitive and cannot recognize array as a valid constructor.

Solution Methods

  1. Replace all instances of new array() with new Array()
  2. Alternatively, use array literal notation [] which is the preferred modern syntax

Code Examples

Here's the corrected version using proper Array constructor:

function AlarmAbsolute() {};
AlarmAbsolute.prototype.daysOfTheWeek = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
console.log(AlarmAbsolute.prototype.daysOfTheWeek);

Or using array literal syntax (recommended):

function AlarmAbsolute() {};
AlarmAbsolute.prototype.daysOfTheWeek = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
console.log(AlarmAbsolute.prototype.daysOfTheWeek);

Additional Tips

  • Always use proper JavaScript casing for built-in objects (Array, Object, String, etc.)
  • Consider using array literals [] instead of the Array constructor for better performance and readability
  • If you encounter this error in tizen.js, it might be worth checking if you're using the correct version of the file

Customize your cookie preferences

You can enable or disable non-essential cookies. Essential cookies are always on to ensure the site works properly and to keep you signed in.

Necessary

These cookies are necessary for the website to function properly and cannot be switched off. They help with things like logging in and setting your privacy preferences.

Always on

Analytics

These cookies help us improve the site by tracking which pages are most popular and how visitors move around the site.

Enable analytics cookies
Public Forum Public Forum
Employees only. Please sign in with your company account.