[JS and C # at the same time]
[Common js functions]
Alert
Confirm
Escape
Eval
IsNaN
ParseFloat
ParseInt
Prompt
Unescape
[Array]
Js C #
Array. join-> string. join
Reverse-> array.
Sort-> array.
GetMonth 0-11
[Math]
Attribute (constant)
Js:
E, LN2, LN10, LOG2E ..
PI, SQRT1_2, SQRT2
C #
E, PI
Function:
Abs
Acos asin atan radian Value
Multiplication of exp e
Log
Pow floor max min random
Math. floor (Math. random * 5)
Take a random value of less than 5.
Ceil (C #: Ceiling)
The first letter in Javascript is lowercase.
C # uppercase letters
[String]
Js provides a large amount of html effect generation
C # static method:
Compare, Join, Concat
Js: None
IndexOf
LastIndexOf
SubString
CharAt-> array access []
Align left and right
Length attribute
ToLower toUpper Replace Split
C # a large number of functions
CompareTo
StartsWith EndsWith
PadLeft PadRight
Insert Remove Split
Js: replace (rgExp, string) can contain regular expressions.
C # No Regular Expression
Js: int search (rgExp)
C #: Substring (start, length)
Js: substring (start, end)
Js: substr (start, length)
Two Regular Expressions
Var r = new RegExp ("[A-Z]", "g ");
Var r =/[A-Z]/g;
Compile within the loop is faster after compilation
<Strike> strikethrough