Skip to main content

STRING METHODS

STRING METHODS

1.       String.fromCharCode()

2.       String.fromCodePoint()

3.       String.prototype.anchor()

4.       String.prototype.big()

5.       String.prototype.blink()

6.       String.prototype.bold()

7.        String.prototype.charAt()

8.        String.prototype.charCodeAt()

9.        String.prototype.codePointAt()

10.            String.prototype.concat()

11.            String.prototype.endsWith()

12.            String.prototype.fixed()

13.            String.prototype.fontcolor()

14.            String.prototype.fontsize()

15.            String.prototype.includes()

16.            String.prototype.indexOf()

17.            String.prototype.italics()

18.            String.prototype.lastIndexOf()

19.            String.prototype.link()

20.            String.prototype.localeCompare()

21.            String.prototype.match()

22.            String.prototype.matchAll()

23.            String.prototype.normalize()

24.            String.prototype.padEnd()

25.            String.prototype.padStart()

26.            String.prototype.repeat()

27.            String.prototype.replace()

28.            String.prototype.replaceAll()

29.            String.prototype.search()

30.            String.prototype.slice()

31.            String.prototype.small()

32.            String.prototype.split()

33.            String.prototype.startsWith()

34.            String.prototype.strike()

35.            String.prototype.sub()

36.            String.prototype.substr()

37.            String.prototype.substring()

38.            String.prototype.sup()

39.            String.prototype.toLocaleLowerCase()

40.            String.prototype.toLocaleUpperCase()

41.            String.prototype.toLowerCase()

42.            String.prototype.toSource()

43.            String.prototype.toString()

44.            String.prototype.toUpperCase()

45.            String.prototype.trim()

46.            String.prototype.trimEnd()

47.            String.prototype.trimStart()

48.            String.prototype.valueOf()

49.            String.prototype[@@iterator]()

50.            String.raw()



charAt()

var  str = “SSC”

var ind =  2

var ans = str.charAt(index) //C

 

It will print the character present at the index 2

 

CharCode()

Var ans = String.fromCharCode(65, 66, 67) //”A”,”B”,”C”
 
It deals with UTF-16.To Know more about UTF -16

 

charCodeAt()

 

var  str = “SSC”

var ind =  2

var ans = str.charCodeAt(index) //65

 

It will write the charcode of “C”

 

concat()

var str1 = “Seeta”

var str2 = “Raman”

var ans  = str1+str2  //”SeetaRaman”


It helps to join/concate two or more strings.

Comments

Popular posts from this blog

  You are provided with the radius of a circle "A". Find the length of its circumference. Note: In case the output is coming in decimal, roundoff to 2nd decimal place. In case the input is a negative number, print "Error". function   coc () { var   r = document . getElementById ( "num1" ). value ; var   pi = 3.1415 ; var   Circumference =( 2 * pi * r ); if  ( r >= 0 ) console . log ( Circumference ); else console . log ( "Error" )} 
The area of an equilateral triangle is ¼(√3a 2 ) where "a" represents a side of the triangle. You are provided with the side "a". Find the area of the equilateral triangle. function   sqrt () { var   a = document . getElementById ( "a" ). value ; b =  Math . sqrt ( 3 ); c =( 1 / 4 )* b * a * a ; console . log (  "Area =" + c )}

HOISTING

  HOISTING Variables” and “ function” declarations are moved to the top of their scope before code execution. Variables are hosted and not their values Only the normal function will be hoisted not the anonymous,IIFE and Arrow Function will be hoisted Properties are not hoisted PROPERTY  Any variable declared globally  become property of window variable declared without keyword variable declared with keyword var except function scope var console . log ( a )   // Error a not defined console . log ( a );  // undefined --> var a is hoisted not value var   a  =  20 ; console . log ( a , b )  // Error --->property b can't hoist var   a  =  20 ; b  =  40 ; var   a  = add ( 2 , 5 )  // Error console . log ( a ) var   a  = add ( 2 , 5 )  // 7 function add hoist console . ...