“Pokrój ciąg JavaScript” Kod odpowiedzi

Pokrój ciąg JavaScript

const str = 'The quick brown fox jumps over the lazy dog.';

console.log(str.slice(31));
// expected output: "the lazy dog."

console.log(str.slice(4, 19));
// expected output: "quick brown fox"
Expensive Eland

Plasterek sznurka

string word = "hello";
string ordw = word.Substring(1) + word.Substring(0, 1);
Amused Angelfish

JavaScript Slice Ciąg z postaci

var input = 'john smith~123 Street~Apt 4~New York~NY~12345';

var fields = input.split('~');

var name = fields[0];
var street = fields[1];
Lokesh003

splice strunowe

newStr = str.split(''); // or newStr = [...str];
newStr.splice(2,5);
newStr = newStr.join('');
GutoTrosla

Metoda String String Slice JavaScript

// You use this method to cut out a substring from an entire string.
// We will use this method to cut out the remaining part of a word (excluding the first letter):

const word = "freecodecamp"

const remainingLetters = word.substring(1)
// reecodecamp
OHIOLee

Odpowiedzi podobne do “Pokrój ciąg JavaScript”

Pytania podobne do “Pokrój ciąg JavaScript”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu