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

get first 10 characters of string javascript

String.substring(0, 10);
Comment

PREVIOUS NEXT
Code Example
Javascript :: cancel settimeout 
Javascript :: localstorage save array 
Javascript :: react redux wait for props 
Javascript :: drupal 8 get node from path alias 
Javascript :: js date after 1 year 
Javascript :: filter falsy values 
Javascript :: html add new line in js alert 
Javascript :: js not equal to null 
Javascript :: get only day from date in javascript 
Javascript :: compress string javascript 
Javascript :: how to change active tab jquery 
Javascript :: vuex v-model 
Javascript :: (node:2496) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead. 
Javascript :: gulp delete files 
Javascript :: modify margin top javascript 
Javascript :: javascript open new window 
Javascript :: last index array javascript 
Javascript :: get the value or text from select element using javaScript 
Javascript :: how to remove menu bar in electron app without removing frame 
Javascript :: iterate object keys javascript 
Javascript :: how to send emoji as ID discord.js 
Javascript :: rgb to hex js 
Javascript :: vuejs string contains 
Javascript :: check if function is async javascript 
Javascript :: jquery datatables get selected row data 
Javascript :: javascript clone array of object 
Javascript :: firebase react router page not found on page refresh 
Javascript :: react event target square brackets 
Javascript :: array left rotation javascript 
Javascript :: jquery event element is visible 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =