Hướng dẫn what is unescape in javascript? - không thoát trong javascript là gì?

W3Schools được tối ưu hóa cho việc học và đào tạo. Ví dụ có thể được đơn giản hóa để cải thiện việc đọc và học tập. Hướng dẫn, tài liệu tham khảo và ví dụ được xem xét liên tục để tránh lỗi, nhưng chúng tôi không thể đảm bảo tính chính xác đầy đủ của tất cả các nội dung. Trong khi sử dụng W3Schools, bạn đồng ý đã đọc và chấp nhận các điều khoản sử dụng, cookie và chính sách bảo mật của chúng tôi.

Bản quyền 1999-2022 bởi dữ liệu refsnes. Đã đăng ký Bản quyền. W3Schools được cung cấp bởi W3.CSS.
W3Schools is Powered by W3.CSS.

Cải thiện bài viết

Lưu bài viết

Điều kiện tiên quyết: hàm Escape [] JavaScript Escape [] JavaScript escape[] Function

Dưới đây là ví dụ về hàm unescape [].unescape[] function.

  • Example:

       

    unescape[string]
    0
    unescape[string]
    1
    unescape[string]
    2

       

    unescape[string]
    4
    unescape[string]
    5
    unescape[string]
    6

       

    unescape[string]
    0
    unescape[string]
    9
    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    0

    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    1
    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    2
    unescape[string]
    2

    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    4

  • Output:
    Geeks for Geeks!!!
    To contribute articles contact us at 
    
    Geeks for Geeks!!!
    To contribute articles contact us at 
    

Hàm unescape [] trong javascript lấy một chuỗi làm tham số và sử dụng để giải mã chuỗi đó được mã hóa bởi hàm Escape []. Trình tự thập lục phân trong chuỗi được thay thế bằng các ký tự mà chúng đại diện khi được giải mã thông qua unescape [].unescape[] function in JavaScript takes a string as a parameter and uses to decode that string encoded by the escape[] function. The hexadecimal sequence in the string is replaced by the characters they represent when decoded via unescape[].

Syntax:

unescape[string]

Tham số: Hàm này chấp nhận một tham số duy nhất như đã đề cập ở trên và được mô tả dưới đây: This function accepts a single parameter as mentioned above and described below:

  • Chuỗi: Các tham số này giữ chuỗi sẽ được giải mã. This parameters holds the string that will be decoded.

    Giá trị trả về: Hàm này trả về một chuỗi được giải mã. This function returns a decoded string.

    Lưu ý: Hàm này chỉ giải mã các ký tự đặc biệt, hàm này bị tước bỏ. / * _ This function only decodes the special characters, this function is depricated.
    Exceptions: @ – + . / * _

    Thêm mã ví dụ cho hàm trên như sau: Chương trình 1:
    Program 1:

    ________số 8

       

    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    7
    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    8
    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    9
    unescape[string]
    6

       

    unescape[string]
    4
    escape[ string ]
    3
    escape[ string ]
    4

       

    unescape[string]
    4
    unescape[string]
    5
    unescape[string]
    6

       

    unescape[string]
    4
    Geeks%20for%20Geeks%21%21%21
    To%20contribute%20articles%20contact%20us%20atcontribute
    @geeksforgeeks.org 
    1
    Geeks%20for%20Geeks%21%21%21
    To%20contribute%20articles%20contact%20us%20atcontribute
    @geeksforgeeks.org 
    2

       

    unescape[string]
    4
    Geeks%20for%20Geeks%21%21%21
    To%20contribute%20articles%20contact%20us%20atcontribute
    @geeksforgeeks.org 
    5
    unescape[string]
    6

       

    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    8
    Geeks%20for%20Geeks%21%21%21
    To%20contribute%20articles%20contact%20us%20atcontribute
    @geeksforgeeks.org 
    9
    unescape[string]
    0

    unescape[string]
    1
    unescape[string]
    2
    unescape[string]
    3

       

    unescape[string]
    4
    escape[ string ]
    3
    escape[ string ]
    4

       

    unescape[string]
    4
    unescape[string]
    5
    unescape[string]
    6

       

    unescape[string]
    4
    Geeks%20for%20Geeks%21%21%21
    To%20contribute%20articles%20contact%20us%20atcontribute
    @geeksforgeeks.org 
    1
    Geeks%20for%20Geeks%21%21%21
    To%20contribute%20articles%20contact%20us%20atcontribute
    @geeksforgeeks.org 
    2

    Geeks for Geeks!!!
    To contribute articles contact us at  
    
    6

    Output:

    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    

       

    Encoded : Geeks%20for%20Geeks%21%21%21
    Decoded : Geeks for Geeks!!!
    
    Encoded : To%20contribute%20articles%20contact%20us%20at%20
    Decoded : To contribute articles contact us at 
    
    8
    Geeks%20for%20Geeks%21%21%21
    To%20contribute%20articles%20contact%20us%20atcontribute
    @geeksforgeeks.org 
    9
    unescape[string]
    0

    • Các trình duyệt được hỗ trợ:
    • Google Chrome 1 trở lên
    • Cạnh 12 trở lên
    • Internet Explorer 3 trở lên
    • Mozilla Firefox 1 trở lên
    • Safari 1 trở lên

Hàm Escape [] có thể được sử dụng để mã hóa một chuỗi để sử dụng trong hàm url. Hàm unescape [] có thể được sử dụng để giải mã một chuỗi được mã hóa. Các chức năng này có thể được sử dụng để đảm bảo rằng một chuỗi an toàn để sử dụng trong URL. Các chức năng này có thể được sử dụng để giải mã một chuỗi đã được mã hóa để sử dụng trong URL.
1. escape[] function: This function takes a string as a single parameter & encodes the string that can be transmitted over the computer network which supports ASCII characters. Encoding is the process of converting plain text into ciphertext.

Syntax:

escape[ string ]

Tham số: Hàm này chấp nhận một tham số duy nhất: This function accepts a single parameter:

  • Tôi có thể sử dụng gì thay vì Unescape? This parameter holds the string that will be encoded.

Hàm unescape [] không được chấp nhận. Sử dụng decodeUri [] hoặc decodeuricomponent [] thay thế. Returns an encoded string.

Việc sử dụng chức năng thoát trong JavaScript là gì? The escape[] function only encodes the special characters, this function is deprecated.

Ngoại lệ: @ - +. / * _ @ – + . / * _

Ví dụ 1: Trong ví dụ này, chúng tôi đã sử dụng ký tự đặc biệt để xem các thay đổi. & NBSP;In this example, we have used the special character to see the changes. 

JavaScript

   

Geeks for Geeks!!!
To contribute articles contact us at  
9
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
9
unescape[string]
2

   

unescape[string]
4
unescape[string]
5
unescape[string]
6

   

Geeks for Geeks!!!
To contribute articles contact us at  
9
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20
          at%20
Decoded : To contribute articles contact us at 
          
8
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
0

01

unescape[string]
2

Geeks for Geeks!!!
To contribute articles contact us at  
6

Output:

Geeks%20for%20Geeks%21%21%21
To%20contribute%20articles%20contact%20us%20atcontribute
@geeksforgeeks.org 

Geeks for Geeks!!!
To contribute articles contact us at  

Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].unescape[] function that will decode the encoded text. Decoding is the process of converting ciphertext into plain text. 

Ví dụ 2: & nbsp;This function takes a string as a single parameter and uses it to decode that string encoded by the escape[] function. The hexadecimal sequence in the string is replaced by the characters they represent when decoded via unescape[] function.

Syntax:

unescape[string]

Tham số: Hàm này chấp nhận một tham số duy nhất: This function accepts a single parameter:

  • Chuỗi: Tham số này giữ chuỗi sẽ được giải mã. This parameter holds the string that will be decoded.

Giá trị trả về: Trả về một chuỗi được giải mã. Returns a decoded string.

Lưu ý: Hàm này chỉ giải mã các ký tự đặc biệt, chức năng này không được dùng nữa.This function only decodes the special characters, this function is deprecated.

Ngoại lệ: @ - +. / * _ @ – + . / * _

Ví dụ 1: Trong ví dụ này, chúng tôi đã sử dụng ký tự đặc biệt để xem các thay đổi. & NBSP;In this example, we have used the special character to see the changes. 

JavaScript

   

unescape[string]
0
unescape[string]
1
unescape[string]
2

   

unescape[string]
4
unescape[string]
5
unescape[string]
6

   

unescape[string]
0
unescape[string]
9
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
0

Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
1   8
unescape[string]
2

Geeks for Geeks!!!
To contribute articles contact us at  
6

Output:

Geeks for Geeks!!!
To contribute articles contact us at  

Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].

Ví dụ 2: & nbsp;

JavaScript

Geeks for Geeks!!!
To contribute articles contact us at  

Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].

   

unescape[string]
4
unescape[string]
5
unescape[string]
6

Ví dụ 2: & nbsp;

   

unescape[string]
4
Geeks%20for%20Geeks%21%21%21
To%20contribute%20articles%20contact%20us%20atcontribute
@geeksforgeeks.org 
5
unescape[string]
6

   

Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
7
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
8
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
9
unescape[string]
6

   

unescape[string]
4
escape[ string ]
3
escape[ string ]
4

Từ ví dụ trên, chúng ta có thể thấy mã hóa được giải mã cho văn bản thuần túy bằng cách sử dụng hàm unescape [].

   

unescape[string]
4
unescape[string]
5
unescape[string]
6

Ví dụ 2: & nbsp;

Geeks for Geeks!!!
To contribute articles contact us at  
6

Output:

Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20
          at%20
Decoded : To contribute articles contact us at 
          

   

Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
7
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
8
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
9
unescape[string]
6

 

unescape[]

escape[]

1.

   

unescape[string]
4
escape[ string ]
3
escape[ string ]
4

   

unescape[string]
4
Geeks%20for%20Geeks%21%21%21
To%20contribute%20articles%20contact%20us%20atcontribute
@geeksforgeeks.org 
1
Geeks%20for%20Geeks%21%21%21
To%20contribute%20articles%20contact%20us%20atcontribute
@geeksforgeeks.org 
2

2.

   

Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
8
Geeks%20for%20Geeks%21%21%21
To%20contribute%20articles%20contact%20us%20atcontribute
@geeksforgeeks.org 
9
Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
0

Encoded : Geeks%20for%20Geeks%21%21%21
Decoded : Geeks for Geeks!!!

Encoded : To%20contribute%20articles%20contact%20us%20at%20
Decoded : To contribute articles contact us at 
1
unescape[string]
22

3.

Sự khác biệt giữa hàm unescape [] & escape []:

Hàm unescape [] được sử dụng để giải mã chuỗi được mã hóa bởi hàm Escape [].

Sự khác biệt giữa hàm unescape [] & escape []:

Hàm unescape [] được sử dụng để giải mã chuỗi được mã hóa bởi hàm Escape [].

4. Hàm Escape [] trong JavaScript được sử dụng để mã hóa một chuỗi. Sử dụng hỗ trợ ký tự ASCII, nó tạo ra một chuỗi di động để nó có thể được truyền qua bất kỳ mạng nào đến bất kỳ máy tính nào.Một chuỗi được giải mã được trả về.
5. Một chuỗi được mã hóa được trả về.Hàm này chỉ mã hóa các ký tự đặc biệt, chức năng này không được dùng nữa.

Unescape có nghĩa là gì?

: không trốn thoát: giữ lại.Hơi không được phân loại.not escaped : retained. unescaped vapors.

Escape và unescape là gì?

Hàm Escape [] có thể được sử dụng để mã hóa một chuỗi để sử dụng trong hàm url. Hàm unescape [] có thể được sử dụng để giải mã một chuỗi được mã hóa.Các chức năng này có thể được sử dụng để đảm bảo rằng một chuỗi an toàn để sử dụng trong URL.Các chức năng này có thể được sử dụng để giải mã một chuỗi đã được mã hóa để sử dụng trong URL. The unescape[] function can be used to decode an encoded string. These functions can be used to ensure that a string is safe for use in a URL. These functions can be used to decode a string that has been encoded for use in a URL.

Tôi có thể sử dụng gì thay vì Unescape?

Hàm unescape [] không được chấp nhận.Sử dụng decodeUri [] hoặc decodeuricomponent [] thay thế.decodeURI[] or decodeURIComponent[] instead.

Việc sử dụng chức năng thoát trong JavaScript là gì?

Hàm Escape [] tính toán một chuỗi mới trong đó một số ký tự đã được thay thế bằng chuỗi thoát thập lục phân.Lưu ý: Hàm này được sử dụng chủ yếu cho các truy vấn URL [phần của URL sau?]computes a new string in which certain characters have been replaced by a hexadecimal escape sequence. Note: This function was used mostly for URL queries [the part of a URL following ? ] —not for escaping ordinary String literals, which use the format \xHH .

Bài Viết Liên Quan

Chủ Đề