Giter Club home page Giter Club logo

array_in_depth_lec_work.'s Introduction

Array_in_depth_lec_work.

 var names=["ahmad","sultan","jajja","danish","jajja","hamid","jajja"];

console.log("array",names);

console.log("array-length=",names.length);

console.log("last-index=",names[names.length-1]);

// push operation

// push operation insert value at the last index

console.log("array before push operation=>",names);

names.push("hasnain jajja");

console.log("array after push operation=>",names);

// pop operation 

// pop operation delete value at the last index

console.log("array before pop operation=>",names);

names.pop();

console.log("array after pop operation=>",names);

// unshift operation

// unshift function insert values at first index and value stored at index 1 shifted to next index

console.log("array before unshift operation=>",names);

names.unshift("ali jajja");

console.log("array after unshift operation=>",names);

// shift operation

// shift operation delete value at start index

console.log("array before shift operation=>",names);

names.shift();

console.log("array after shift operation=>",names);

// splice operation

// ist value(2) means start from 2 index

// 2nd value(2) means(two deleting index) delete values at index 2 and 3

// 3rd value(cs-student,chemistry student,2) means insert values at index 2,3,4 and remaining value will start from upcoming index



console.log("array before splice operation=>",names);

names.splice(2,2,"cs_student","chemistry student",2);

console.log("array after splice operation=>",names);



// slice operation

// slice operation uses for making another array from the values of first array but the values in first array remains same.

// first value(0) means value stored at index 0 of array will be included.

// 2nd value(7) means values stored before index 7 will be included and value stored at index 7 will not be included.   

console.log("array before slice operation=>",names);

var newNames=names.slice(0,7);

console.log("array after slice operation=>",names);

console.log("new array=>",newNames);


// first lecture of array is over

array_in_depth_lec_work.'s People

Contributors

ahmadjajja avatar

Stargazers

mohsin raza abid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.