Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to get the first character of a string in javascript

let str = 'John Wick'
let firstChar = str.charAt(0) 
console.log(firstChar); // "J" 
Comment

get first word of string js

let myStr = "Hello World"
let firstWord = myStr.split(" ")[0]
Comment

get the first word of a string javascript

let sentence = "The big brown fox"
let word = sentence.split(" ")[0]

console.log(word) // The
Comment

js get first letter of string

var x = 'some string';
alert(x.charAt(0)); // alerts 's'
Comment

js get words first letter

var str = "Java Script Object Notation";
var matches = str.match(/(w)/g); // ['J','S','O','N']
var acronym = matches.join(''); // JSON

console.log(acronym)
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript pluck from array of objects 
Javascript :: get dir from filepath javascript 
Javascript :: update chart js with new data 
Javascript :: react js image path src from local folder 
Javascript :: convert number to boolean javascript 
Javascript :: set property dom javascrpt 
Javascript :: regexp constructor js 
Javascript :: click right mouse javascript 
Javascript :: return elemnt from array 
Javascript :: string-mask javascript 
Javascript :: crear proyecto angular 
Javascript :: javascript array find element by id 
Javascript :: how to store array of object in local storage 
Javascript :: jquery find div with data attribute value 
Javascript :: chartjs lineTension 
Javascript :: how to generate random id in javascript 
Javascript :: javascript onclick select coordinates 
Javascript :: javascript random 4 digit number 
Javascript :: js get element by attribute 
Javascript :: SEQUELIZE OR 
Javascript :: discord.js how to send a message to all guilds 
Javascript :: npm react dom routing 
Javascript :: import js file into another 
Javascript :: joi custom error 
Javascript :: datatable numbering 
Javascript :: jshint esversion: 6 
Javascript :: js addeventlistener arrow keys 
Javascript :: js get form inputs 
Javascript :: es ignore 
Javascript :: check if numbers are consecutive javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =