A Glimpse of JavaScript’s String, Number and Arrays

  • Number
  • String
  • Boolean
  • Symbol
  • Object
  1. Function
  2. Array
  3. Date
  4. RegExp
  • null
  • Undefined
Math.abs(-5) // 5
Math.floor(5.3) // 5
Math.floor(5.6) // 6
Math.sqrt(9) // 3
Math.sin(0) // 0
const string = “Hello World”;string.length(); // 11string.indexOf(o); // 5string.toUpperCase(); //HELLO WORLDstring.toLowerCase(); //hello worldstring.charAt(5); // o
const jsArray = [‘index1’, ‘index2’, ‘index3’, ‘index4’];
jsArray[2]; // index3
jsArray.push(‘index5’);
// jsArray = [‘index1’, ‘index2’, ‘index3’, ‘index4’, ‘index5’]
jsArray.pop(); // jsArray = [‘index1’, ‘index2’, ‘index3’, ‘index4’]
jsArray.unshift(‘index0’);
// jsArray = [‘index0’, ‘index1’, ‘index2’, ‘index3’, ‘index4’]
jsArray.shift();
// jsArray = [‘index1’, ‘index2’, ‘index3’, ‘index4’]
jsArray.indexOf(‘index2’) // 1
jsArray.reverse();
// jsArray = [‘index4’, ‘index3’, ‘index2’, ‘index1’]
  1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
  2. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String
  3. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number
  4. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math
  5. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store