반응형
javascript slice
-
JavaScript - string 끝에서부터 자르기 (slice)JavaScript 2022. 5. 30. 18:26
자바스크립트에서 String 일부를 자르고 싶을 때 slice() 함수를 사용한다. String.prototype.slice() The slice() method extracts a section of a string and returns it as a new string, without modifying the original string. example 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" cons..