Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get the middle character js

function getMiddle(s)
{
  var position;
  var length;

  if(s.length % 2 == 1) {
      position = s.length / 2;
      length = 1;
  } else {
      position = s.length / 2 - 1;
      length = 2;
  }

  return s.substring(position, position + length)
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular module with routing cli 
Javascript :: add expiry to jwt extended token 
Javascript :: node express js set server timeout 
Javascript :: js detect scroll 
Javascript :: javascript object get element by index 
Javascript :: delete elment javascript after fade out 
Javascript :: indexof case insensitive javascript 
Javascript :: how to get browser url in javascript 
Javascript :: find the missing value in an integer array javascript 
Javascript :: Could not resolve dependency: npm ERR! peer reac 
Javascript :: React modal input field auto focus antd 
Javascript :: get current url last part angular 
Javascript :: how to create a react app in current folder 
Javascript :: angular how to get previous state 
Javascript :: has not class jquery 
Javascript :: find last element with class jquery 
Javascript :: js ask before close chrome 
Javascript :: react input number 
Javascript :: cloudinary download url 
Javascript :: vscode file cannot be loaded because running scripts is disabled on this system 
Javascript :: convert the following 2 d array into 1 d array in javascript 
Javascript :: bash parse json 
Javascript :: java script cosinus grad 
Javascript :: check when keyup an input from a specific form jquery 
Javascript :: js html play beep 
Javascript :: refresh page scrolltop 0 
Javascript :: regrex for password 
Javascript :: faker.js lorem 
Javascript :: jquery first element 
Javascript :: new date with date + 1 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =