Skip to content

lgope/JavaScript

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

71 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

JavaScript

JavaScript, often abbreviated as JS, is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm. It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions. The of this repo is to save my js programs. Basics of JavaScript. Beginner level.

Table of Contents

  1. Important Methods

Methods

Most important javascript build in methods

  • 1.1 typeof: Returns the type.
console.log(typeof 44); // number

console.log(typeof 'something'); // string 

console.log(typeof true); // boolean

let num = 12;
console.log(typeof(num)); // number

  • 1.2 toString: Returns the string representation of the number's value.
let num = 10;
let n = num.toString();

console.log(typeof(num)); // number

console.log(typeof(n)); // string

  • 1.3 indexOf: Returns the first index at which a given element can be found in the array, or -1 if it is not present.
let str = "Hello world, welcome to the JS Universe.";
console.log(str.indexOf("welcome")); // 13
console.log(str.indexOf("wall")); // -1

const fruits = ['Orange', 'Pineapple', 'Apple', 'Melon'];
console.log(fruits.indexOf('Melon')); // 3

console.log(fruits.indexOf('klkljkh')); // -1

  • 1.4 lastIndexOf: Returns the last index at which a given element can be found in the array, or -1 if it is not present.
const fruits = ['Orange', 'Pineapple', 'Apple', 'Melon'];
console.log(fruits.lastIndexOf('Melon')); // 3

console.log(fruits.lastIndexOf('klkljkh')); // -1

  • 1.5 length: Returns the number of characters or size in a string or array.
const fruits = ['Orange', 'Pineapple', 'Apple', 'Melon'];
console.log(fruits.length); // 4

let str = "Hello world, welcome to the JS Universe.";
console.log(str.length); // 40
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy