{"id":127,"date":"2022-10-29T08:15:05","date_gmt":"2022-10-29T08:15:05","guid":{"rendered":"https:\/\/devopssupport.in\/blog\/?p=127"},"modified":"2022-11-02T12:01:31","modified_gmt":"2022-11-02T12:01:31","slug":"javascript-methods","status":"publish","type":"post","link":"https:\/\/www.devopssupport.in\/blog\/javascript-methods\/","title":{"rendered":"JAVASCRIPT METHODS"},"content":{"rendered":"\n<ol class=\"wp-block-list\"><li>length \/\/ it is a property<\/li><li>toLowerCase()<\/li><li>toUpperCase()<\/li><li>Includes()<\/li><li>startsWith()<\/li><li>endsWith()<\/li><li>search()<\/li><li>match()<\/li><li>indexOf()<\/li><li>lastIndexOf()<\/li><li>replace()<\/li><li>trim()<\/li><li>charAt()<\/li><li>charCodeAt()<\/li><li>fromCharCode()<\/li><li>concat()<\/li><li>Split()<\/li><li>repeat()<\/li><li>slice()<\/li><li>substr()<\/li><li>substring()<\/li><li>toString()<\/li><li>valueOf()<\/li><\/ol>\n\n\n\n<ol class=\"wp-block-list\"><li>length()  \/\/It is a property<\/li><\/ol>\n\n\n\n<p>Example:-<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/2c728d2d2752f12e2dfb38462d311500.js\"><\/script>\n\n\n\n<p>Output: 30<\/p>\n\n\n\n<p>2. toLowerCase() \/\/Methods are having round brackets<\/p>\n\n\n\n<p>Example:-<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/9cb47839f35f5c721f80927071e206c8.js\"><\/script>\n\n\n\n<p>Output: javascript is a great language<\/p>\n\n\n\n<p>3. toUpperCase()<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/439427a0179930bf18a16536b2b3fd23.js\"><\/script>\n\n\n\n<p>Output: JAVASCRIPT IS A GREAT LANGUAGE<\/p>\n\n\n\n<p>4. includes()<\/p>\n\n\n\n<p>Includes use to find text or word form content . It shows result in true or false.<\/p>\n\n\n\n<p>It is case sensitive method.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/c2869610b4c38abdc562a162643fa7e9.js\"><\/script>\n\n\n\n<p>Output: true<\/p>\n\n\n\n<p>5. startsWith()<\/p>\n\n\n\n<p>It returns the first word or character of the sentence<\/p>\n\n\n\n<p>It is a case sensitive method<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/602da1c5fcc7268d4cae3d3ab8ecd3b3.js\"><\/script>\n\n\n\n<p>Output: true<\/p>\n\n\n\n<p>6. endsWith()<\/p>\n\n\n\n<p>It returns the last word or character of the sentence<\/p>\n\n\n\n<p>It is a case sensitive method<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/7b91dcb31eb34f19e4a12df42496242a.js\"><\/script>\n\n\n\n<p>Output: true<\/p>\n\n\n\n<p>&nbsp;7.&nbsp;&nbsp; Search()<\/p>\n\n\n\n<p>It search word and show the index value.<\/p>\n\n\n\n<p>If this method didn\u2019t find anything then it returns -1<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/b9db82b6fdb9a7bcb33594b844bec223.js\"><\/script>\n\n\n\n<p>Output: 11<\/p>\n\n\n\n<p>8.  match()<\/p>\n\n\n\n<p>It match the word and make it array<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/2f858d2adb87096a4932291ce238c59b.js\"><\/script>\n\n\n\n<p>Output: is,is<\/p>\n\n\n\n<p>9. indexOf()<\/p>\n\n\n\n<p>It search position from start and returns index value<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/e375684425675a29592e51ba054ea658.js\"><\/script>\n\n\n\n<p>Output: 11<\/p>\n\n\n\n<p>10. lastIndexOf()<\/p>\n\n\n\n<p>It search position of last and returns index value<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/6eee8bdef54903bc11614bef937b2e4c.js\"><\/script>\n\n\n\n<p>Output: 22<\/p>\n\n\n\n<p>11. replace()<\/p>\n\n\n\n<p>It replace the words<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/f52baff9741048534a84bf0a945f647c.js\"><\/script>\n\n\n\n<p>Output: python is a GREAT Language<\/p>\n\n\n\n<p>12. trim()<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/583518ec2ca6bfee97edae7cc6d07fb4.js\"><\/script>\n\n\n\n<p>Output: JavaScript is a GREAT Language<\/p>\n\n\n\n<p>13. charAt()<\/p>\n\n\n\n<p>It returns the position index value.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/85724d5682ac238b47035501b5e44b4f.js\"><\/script>\n\n\n\n<p>Output: a<\/p>\n\n\n\n<p>14. charCodeAt()<\/p>\n\n\n\n<p>It returns ascii code of given value.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/21e7502005ff7d0c1b4852fbffda912a.js\"><\/script>\n\n\n\n<p>Output: 97<\/p>\n\n\n\n<p>15. formCharCode()<\/p>\n\n\n\n<p>It shows the ASCII value of given value.<\/p>\n\n\n\n<p>It doesn&#8217;t need any string it has inbuilt object<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/fdbbbe0ed3efd524bdb23f9bbc4113ae.js\"><\/script>\n\n\n\n<p>Output: A<\/p>\n\n\n\n<p><strong>ASCII code table<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/devopssupport.in\/blog\/wp-content\/uploads\/2022\/10\/ascii-codes-128.png\" alt=\"\" class=\"wp-image-131\" width=\"650\" height=\"371\" srcset=\"https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2022\/10\/ascii-codes-128.png 700w, https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2022\/10\/ascii-codes-128-300x171.png 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/figure>\n\n\n\n<p>16. concat()<\/p>\n\n\n\n<p>This function concat or add 2 or more strings.<\/p>\n\n\n\n<p>Example: <\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/d682bcc7b1f25132fa6fcb4602dab25b.js\"><\/script>\n\n\n\n<p>Output:<\/p>\n\n\n\n<p>JavaScript is a GREAT Language also python is great language<\/p>\n\n\n\n<p>17. split()<\/p>\n\n\n\n<p>It method use to make&nbsp; array of string where we put split function<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/adaefb35a47ea1b9b5beaa5abeab82fb.js\"><\/script>\n\n\n\n<p>Output: JavaScript,is,a,GREAT,Language<\/p>\n\n\n\n<p>18.  repeat()<\/p>\n\n\n\n<p>It repeat the string as our preference.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/78604a010246e2c3c2c580f9c0ffae3a.js\"><\/script>\n\n\n\n<p>Output: JavaScript is a GREAT LanguageJavaScript is a GREAT Languageuage<\/p>\n\n\n\n<p>19.  slice()<\/p>\n\n\n\n<p>It basic use two parameters first character shows for where starts(parameter1) the string with and second parameters shows to the end.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/89abd42bd06615f8ea49d4be8dafcdab.js\"><\/script>\n\n\n\n<p><a href=\"Output:\nvaScript is a\">Output: <\/a>vaScript is a<\/p>\n\n\n\n<p>20. substr()<\/p>\n\n\n\n<p>It is work similarly as slice but it count value where first parameter is starts.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/316dcc0cc06a6a36595627d84c069afb.js\"><\/script>\n\n\n\n<p><a href=\"Output:\nvaScript is a\">Output: <\/a> vaSc<\/p>\n\n\n\n<p>21.  substring()<\/p>\n\n\n\n<p>It is work similarly as substr but it when show parameter2 then it shows less 1 charecter(if we write 5th place it retuns 4th place value)<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/bd389af41a29995bb5fc7d81f52a3d4b.js\"><\/script>\n\n\n\n<p><a href=\"Output:\nvaScript is a\">Output<\/a>: vaS<\/p>\n\n\n\n<p>22. toString()<\/p>\n\n\n\n<p>It converts datatype to the string.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/aad2f23ed8e7d11bde7ee1482289e004.js\"><\/script>\n\n\n\n<p>Output: 55 (as a string)<\/p>\n\n\n\n<p>23. valueOf()<\/p>\n\n\n\n<p>This function is default, It show string as it is.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/AvinashKumar33\/a7e11036be909f0817c50bdf46e5fe49.js\"><\/script>\n\n\n\n<p>Output: JavaScript is a GREAT Language<\/p>\n","protected":false},"excerpt":{"rendered":"<p>length \/\/ it is a property toLowerCase() toUpperCase() Includes() startsWith() endsWith() search() match() indexOf() lastIndexOf() replace() trim() charAt() charCodeAt() fromCharCode() concat() Split() repeat() slice() substr() substring() toString()&#8230; <\/p>\n","protected":false},"author":2,"featured_media":136,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[45,49,51,50],"class_list":["post-127","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-javascript","tag-javascript-cheetsheet","tag-javascript-function","tag-javascript-methods"],"_links":{"self":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/comments?post=127"}],"version-history":[{"count":6,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/127\/revisions"}],"predecessor-version":[{"id":146,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/127\/revisions\/146"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/media\/136"}],"wp:attachment":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/media?parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/categories?post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/tags?post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}