JS and C # at the same time

Source: Internet
Author: User

[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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.