Javascript String Method includes()
- Categories:
- javascript
Method javascript includes()
digunakan untuk mencari apakah suatu substring berada dalam suatu string. Return value dari method ini adalah true atau false.
Sintaks
string.includes(targetString, position)
- targetString: wajib diisi. Ini merupakan string yang dicari.
- position: opsional. Posisi pertama pencarian string dimulai.
Contoh
var str = "hello world";
str.includes("world"); // true
str.includes("worLd"); // false
Method ini hanya tersedia oleh browser modern dimana telah support Ecmascript 6 dan method ini tidak tersedia pada peramban Internet Explorer 11 atau lebih lama.
- Tags:
- #javascript
Recent Posts
AWS Secrets Manager
Explanation about AWS Secrets Manager with example code.
Envelope Encryption
Envelope encryption is the practice of encrypting plaintext data with a data key, and then encrypting the data key under another key.
Tutorial - "su username vs su - username" - A Security Perspective
The main difference between `su username` and `su - username` lies in the environment variables that are loaded when switching to the specified user.
Subdomain Hijacking
My dormant subdomain was recently hijacked, redirecting it to a online gamble registration page.
C# DbContext ServiceLifeTime
my note about C Sharp ServiceLifeTime