So erhalten Sie das erste Zeichen einer Zeichenfolge in JavaScript
let str = 'John Wick'
let firstChar = str.charAt(0)
console.log(firstChar); // "J"
Busy Buffalo
let str = 'John Wick'
let firstChar = str.charAt(0)
console.log(firstChar); // "J"
let myStr = "Hello World"
let firstWord = myStr.split(" ")[0]
var str="Hello Folks!"
var firstStringChar = str.charAt(0); //H
var x = 'some string';
alert(x.charAt(0)); // alerts 's'
let sentence = "The big brown fox"
let word = sentence.split(" ")[0]
console.log(word) // The
var str = "Java Script Object Notation";
var matches = str.match(/\b(\w)/g); // ['J','S','O','N']
var acronym = matches.join(''); // JSON
console.log(acronym)