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)
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

Ví dụ 2: & nbsp;

JavaScript