JavaScript စာကြောင်းအဆုံးသတ်သည်With()
ဥပမာများ
စာကြောင်းတစ်ခုသည် "ကမ္ဘာ" ဖြင့်အဆုံးသတ်ခြင်းရှိမရှိ စစ်ဆေးပါ-
let text = "Hello world";
let result = text.endsWith("world");
let text = "Hello World";
let result = text.endsWith("world");
အောက်တွင် နောက်ထပ် ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
string တစ်ခုသည် သတ်မှတ်ထားသော စာကြောင်းတစ်ခုဖြင့် အဆုံးသတ်ပါက နည်းလမ်း endsWith()
သည် ပြန်ပေးသည် ။true
မဟုတ်ရင် ပြန်လာမှာပါ false
။
endsWith()
နည်းလမ်းသည် case sensitive ဖြစ်သည် ။
startswith()
နည်းလမ်း ကိုလည်းကြည့်ပါ ။
အထားအသို
string.endsWith(searchvalue, length)
ကန့်သတ်ချက်များ
Parameter | Description |
searchvalue | Required. The string to search for. |
length | Optional. The length of the string to search. Default value is the length of the string. |
တန်ဖိုးကို ပြန်ပေးသည်။
ရိုက်ပါ။ | ဖော်ပြချက် |
ဘူလီယန် | true အကယ်၍ string သည် value နှင့် အဆုံးသတ်ပါက၊ မဟုတ်လျှင် false . |
နောက်ထပ် ဥပမာများ
စာကြောင်းတစ်ကြောင်း၏ပထမစာလုံး ၁၁ လုံးသည် "ကမ္ဘာ" ဖြင့်အဆုံးသတ်ခြင်းရှိမရှိစစ်ဆေးပါ။
let text = "Hello world, welcome to the universe.";
text.endsWith("world", 11);
Browser ပံ့ပိုးမှု
endsWith()
ECMAScript6 (ES6) အင်္ဂါရပ်တစ်ခုဖြစ်သည်။
ES6 (JavaScript 2015) ကို ခေတ်မီဘရောက်ဆာများအားလုံးတွင် ပံ့ပိုးထားပါသည်။
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
endsWith()
Internet Explorer 11 (သို့မဟုတ်အစောပိုင်း) တွင် မပံ့ပိုးပါ။