Mini App Document Mini App Document
  • Start
  • Configuration
  • Framework
  • Custom Components
  • Basic ability
  • Configuration
  • Interface
  • FXML syntax
  • FXS syntax
API
Components
IDE
  • Developer
  • Operator
  • Start
  • Configuration
  • Framework
  • Custom Components
  • Basic ability
  • Configuration
  • Interface
  • FXML syntax
  • FXS syntax
API
Components
IDE
  • Developer
  • Operator
  • Configuration

  • Interface

  • FXML syntax

  • FXS syntax

    • Introduction to FXS
    • Module
    • Variable
    • Comment
    • operator
    • statement
    • Data type
      • number
        • syntax
        • property
        • method
      • string
        • syntax
        • property
        • method
      • boolean
        • syntax
        • property
        • method
      • object
        • syntax
        • property
        • method
      • function
        • syntax
        • arguments
        • Sample code
        • property
        • method
        • Sample code
      • array
        • syntax
        • property
        • method
      • date
        • syntax
        • parameters
        • Sample code
        • property
        • method
      • regexp
        • syntax
        • Sample code
        • property
        • method
      • Data type judgment
        • constructor attribute
        • Sample code
        • typeof
        • Sample code
    • Base class library
  • Framework
  • FXS syntax
2022-08-09
Directory

Data type

The FXS language currently has the following data types:

  • 'number': Numeric value
  • 'string': String
  • 'boolean': Boolean value
  • 'object': Object
  • 'function': Function
  • 'array': Array
  • 'date': Date
  • 'regexp': regular

# number

# syntax

Number includes two numeric values: integer, decimal.

var a = 10;
var PI = 3.141592653589793;

# property

  • 'constructor': Returns the string ''Number''.

# method

  • toString
  • toLocaleString
  • valueOf
  • toFixed
  • toExponential
  • toPrecision

Please refer to the 'ES5' standard for the specific use of the above methods

# string

# syntax

String can be written in two ways:

'hello world';
"hello world";

# property

  • 'constructor': Returns the string ''String''.
  • length

For the specific meanings of attributes other than 'constructor', please refer to the 'ES5' standard

# method

  • toString
  • valueOf
  • charAt
  • charCodeAt
  • concat
  • indexOf
  • lastIndexOf
  • localeCompare
  • match
  • replace
  • search
  • slice
  • split
  • substring
  • toLowerCase
  • toLocaleLowerCase
  • toUpperCase
  • toLocaleUpperCase
  • trim

Please refer to the 'ES5' standard for the specific use of the above methods

# boolean

# syntax

Boolean values have only two specific values: 'true' and 'false'.

# property

  • 'constructor': Returns the string ''Boolean''.
# method
  • toString
  • valueOf

Please refer to the 'ES5' standard for the specific use of the above methods

# object

# syntax

Object is an unordered key-value pair. Here's how to use it:

var o = {} // generates a new empty object

Generates a new non-empty object
o = {
  'string' : 1, the key of //object can be a string
  const_var : 2, the key of //object can also be an identifier that conforms to the rules for defining variables
  The value of func : {}, //object can be of any type
};

Read operations for object properties
console.log(1 === o['string']);
console.log(2 === o.const_var);

Write operations for object properties
o['string']++;
o['string'] += 10;
o.const_var++;
o.const_var += 10;

Read operations for object properties
console.log(12 === o['string']);
console.log(13 === o.const_var);

# property

  • 'constructor': Returns the string ''Object''.
console.log("Object" === {k:"1",v:"2"}.constructor)

# method

  • 'toString': Returns the string ''[object Object]''.

# function

# syntax

function supports the following definitions:

Method 1
function a (x) {
  return x;
}

Method 2
var b = function (x) {
  return x;
}

function also supports the following syntax (anonymous functions, closures, etc.):

var a = function (x) {
  return function () { return x; }
}

var b = a(100);
console.log( 100 === b() );

# arguments

The 'arguments' keyword can be used in function. The keyword currently only supports the following attributes:

  • 'length': the number of arguments passed to the function.
  • '[index]': The 'index' subscript allows you to iterate over every argument passed to the function.

# Sample code

var a = function(){
  console.log(3 === arguments.length);
  console.log(100 === arguments[0]);
  console.log(200 === arguments[1]);
  console.log(300 === arguments[2]);
};
a(100,200,300);

# property

  • 'constructor': Returns the string ''Function''.
  • 'length': Returns the number of formal parameters of the function.

# method

  • 'toString': Returns the string ''[function Function]''.

# Sample code

var func = function (a,b,c) { }

console.log("Function" === func.constructor);
console.log(3 === func.length);
console.log("[function Function]" === func.toString());

# array

# syntax

Array supports the following definitions:

var a = [];      Generates a new empty array

a = [1,"2",{},function(){}];  Generates a new non-empty array whose elements can be of any type

# property

  • 'constructor': Returns the string ''Array''.
  • length

For the specific meanings of attributes other than constructor, see 'ES5' standard.

# method

  • toString
  • concat
  • join
  • pop
  • push
  • reverse
  • shift
  • slice
  • sort
  • splice
  • unshift
  • indexOf
  • lastIndexOf
  • every
  • some
  • forEach
  • map
  • filter
  • reduce
  • reduceRight

Please refer to the 'ES5' standard for the specific use of the above methods.

# date

# syntax

Generating a date object requires the use of the 'getDate' function, which returns an object of the current time.

getDate()
getDate(milliseconds)
getDate(datestring)
getDate(year, month[, date[, hours[, minutes[, seconds[, milliseconds]]]]])

# parameters

  • 'milliseconds': The number of milliseconds calculated from 00:00:00 UTC on January 1, 1970.
  • 'datestring': Date string in the format: "month day, year hours:minutes:seconds".

# Sample code

var date = getDate(); Returns the current time object

date = getDate(1500000000000);
Fri Jul 14 2017 10:40:00 GMT+0800 (China Standard Time)
date = getDate('2017-7-14');
Fri Jul 14 2017 00:00:00 GMT+0800 (China Standard Time)
date = getDate(2017, 6, 14, 10, 40, 0, 0);
Fri Jul 14 2017 10:40:00 GMT+0800 (China Standard Time)

# property

  • 'constructor': Returns the string ''Date''.

# method

  • toString
  • toDateString
  • toTimeString
  • toLocaleString
  • toLocaleDateString
  • toLocaleTimeString
  • valueOf
  • getTime
  • getFullYear
  • getUTCFullYear
  • getMonth
  • getUTCMonth
  • getDate
  • getUTCDate
  • getDay
  • getUTCDay
  • getHours
  • getUTCHours
  • getMinutes
  • getUTCMinutes
  • getSeconds
  • getUTCSeconds
  • getMilliseconds
  • getUTCMilliseconds
  • getTimezoneOffset
  • setTime
  • setMilliseconds
  • setUTCMilliseconds
  • setSeconds
  • setUTCSeconds
  • setMinutes
  • setUTCMinutes
  • setHours
  • setUTCHours
  • setDate
  • setUTCDate
  • setMonth
  • setUTCMonth
  • setFullYear
  • setUTCFullYear
  • toUTCString
  • toISOString
  • toJSON

Please refer to the 'ES5' standard for the specific use of the above methods

# regexp

# syntax

Generating a regexp object requires the use of the 'getRegExp' function.

getRegExp(pattern[, flags])
  • Parameters:
    • 'pattern': The content of the regular expression.
    • 'flags': modifier. The field can contain only the following characters:
      • g: global
      • i: ignoreCase
      • m: multiline。

# Sample code

var a = getRegExp("x", "img");
console.log("x" === a.source);
console.log(true === a.global);
console.log(true === a.ignoreCase);
console.log(true === a.multiline);

# property

  • 'constructor': Returns the string ''RegExp''.
  • source
  • global
  • ignoreCase
  • multiline
  • lastIndex

For the specific meanings of attributes other than constructor, see 'ES5' standard.

# method

  • exec
  • test
  • toString

Please refer to the 'ES5' standard for the specific use of the above methods.

# Data type judgment

# constructor attribute

The 'constructor' attribute can be used for data type judgments.

# Sample code

var number = 10;
console.log( "Number" === number.constructor );

var string = "str";
console.log( "String" === string.constructor );

var boolean = true;
console.log( "Boolean" === boolean.constructor );

var object = {};
console.log( "Object" === object.constructor );

var func = function(){};
console.log( "Function" === func.constructor );

var array = [];
console.log( "Array" === array.constructor );

var date = getDate();
console.log( "Date" === date.constructor );

var regexp = getRegExp();
console.log( "RegExp" === regexp.constructor );

# typeof

Using 'typeof' also allows you to distinguish between some data types.

# Sample code

var number = 10;
var boolean = true;
var object = {};
var func = function(){};
var array = [];
var date = getDate();
var regexp = getRegExp();

console.log( 'number' === typeof number );
console.log( 'boolean' === typeof boolean );
console.log( 'object' === typeof object );
console.log( 'function' === typeof func );
console.log( 'object' === typeof array );
console.log( 'object' === typeof date );
console.log( 'object' === typeof regexp );

console.log( 'undefined' === typeof undefined );
console.log( 'object' === typeof null );
Last update: 2022/08/11, 20:42:12
statement
Base class library

← statement Base class library→

Copyright © 2020-2024 Neuxnet
  • Follow System
  • Light Mode
  • Dark Mode
  • Reading Mode