“String -Methoden JavaScript” Code-Antworten

JavaScript -String -Methoden

//Here are the commonly used JavaScript String methods:

Method	Description
charAt(index)	returns the character at the specified index
concat()	joins two or more strings
replace()	replaces a string with another string
split()	converts the string to an array of strings
substr(start, length)	returns a part of a string
substring(start,end)	returns a part of a string
slice(start, end)	returns a part of a string
toLowerCase()	returns the passed string in lower case
toUpperCase()	returns the passed string in upper9 case
trim()	removes whitespace from the strings
includes()	searches for a string and returns a boolean value
search()	searches for a string and returns a position of a match
SAMER SAEID

JavaScript -String -Methoden

charAt()
charCodeAt()
concat()
endsWith()
includes()
indexOf()
lastIndexOf()
match()
matchAll()
repeat()
replace()
replaceAll()
search()
slice()
split()
startsWith()
substr()
substring()
toLowerCase()
toUpperCase()
toString()
trim()
valueOf()
Clumsy Caiman

String -Methoden JavaScript

const text1 = 'hello';
const text2 = 'world';
const text3 = '     JavaScript    ';

// concatenating two strings
const result1 = text1.concat(' ', text2);
console.log(result1); // "hello world"
// converting the text to uppercase
const result2 = text1.toUpperCase();
console.log(result2); // HELLO
// removing whitespace from the string
const result3 = text3.trim();
console.log(result3); // JavaScript
// converting the string to an array
const result4 = text1.split();
console.log(result4); // ["hello"]
// slicing the string
const result5= text1.slice(1, 3);
console.log(result5); // "el"
SAMER SAEID

Straforma in Stringa js

var x = new String("Una nuova stringa");
Comfortable Capuchin

Ähnliche Antworten wie “String -Methoden JavaScript”

Fragen ähnlich wie “String -Methoden JavaScript”

Weitere verwandte Antworten zu “String -Methoden JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen