Skip to content

commentedcodeX/DevsnestWeb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

@@ -1,394 +0,0 @@

This repository βœ‰ contains the Front End Web Development πŸš€Projects;

Currently, they are related to learnings from the πŸ›° Devsnest Front End Course. Projects are kept "Day-Wise", depending on the Take-Home-Assignments given after each session. As a result, the level of projects would also be ascendant- Beginner to Advanced Level.βŒ›

You can pick up ✍ an idea for the projects ⚑ to practice here and begin

‡️List of projectsπŸŽ“










  1. ChessBoard (THA-16).β™ŸοΈ










  2. ## THA-7 Object Assignment
  3. Object Assignment (THA-7)πŸ“„

    Question-1

    Write a JavaScript program to list the properties of a JavaScript object. Sample object: var student = { name : "David Rayy", sclass : "VI", rollno : 12 }; Sample Output: name,sclass,rollno

    var student = {
      name: 'Prashant Gupta',
      sclass: 'VI',
      rollno: 11,
    };
    var ans = Object.keys(student);
    console.log(ans.join(','));
    
    console.log(student);
    
    delete student.rollno;
    
    console.log(student);

    Question-2

    Write a JavaScript program to delete the rollno property from the following object. Also print the object before or after deleting the property. Sample object: var student = { name : "David Rayy", sclass : "VI", rollno : 12 };

    var student = { name: 'Prashant Gupta', sclass: 'VI', rollno: 12 };
    
    console.log(student);
    delete student.rollno;
    console.log(student);

    Question-3

    Write a JavaScript program to get the length of a JavaScript object. Sample object : var student = { name : "David Rayy", sclass : "VI", rollno : 12 };

    var student = {
      name: 'Prashant Gupta',
      sclass: 'VI',
      rollno: 11,
    };
    var size = Object.keys(student).length;
    console.log(size);

    Question-4

    Write a JavaScript program to display the reading status (i.e. display book name, author name and reading status) of the following books. var library = [ {

      author: 'Bill Gates',
      title: 'The Road Ahead',
      readingStatus: true
    

    }, { author: 'Steve Jobs', title: 'Walter Isaacson', readingStatus: true }, { author: 'Suzanne Collins', title: 'Mockingjay: The Final Book of The Hunger Games', readingStatus: false }];

    var library = [
      {
        author: 'Bill Gates',
        title: 'The Road Ahead',
        readingStatus: true,
      },
      {
        author: 'Steve Jobs',
        title: 'Walter Isaacson',
        readingStatus: true,
      },
      {
        author: 'Suzanne Collins',
        title: 'Mockingjay: The Final Book of The Hunger Games',
        readingStatus: false,
      },
    ];
    
    for (items in library) {
      console.log(library[items].author);
    }
    for (items in library) {
      console.log(library[items].title);
    }
    for (items in library) {
      console.log(library[items].readingStatus);
    }

    Question-5

    Write a JavaScript program to get the volume of a Cylinder with four decimal places using object classes. Volume of a cylinder : V = Ο€r2h where r is the radius and h is the height of the cylinder.z

    const volume = {
      pi: Math.PI,
      radius: 10,
      height: 10,
      ans: function () {
        return (volume.pi * volume.radius ** 2 * volume.height).toFixed(4);
      },
    };
    
    console.log(volume.myVal());

    Question-6

    Write a JavaScript program to sort an array of JavaScript objects. Sample Object : var library = [ {

      title:  'The Road Ahead',
      author: 'Bill Gates',
      libraryID: 1254
    

    }, { title: 'Walter Isaacson', author: 'Steve Jobs', libraryID: 4264 }, { title: 'Mockingjay: The Final Book of The Hunger Games', author: 'Suzanne Collins', libraryID: 3245 }]; Expected Output: [[object Object] { author: "Walter Isaacson", libraryID: 4264, title: "Steve Jobs" }, [object Object] { author: "Suzanne Collins", libraryID: 3245, title: "Mockingjay: The Final Book of The Hunger Games" }, [object Object] { author: "The Road Ahead", libraryID: 1254, title: "Bill Gates" }]

    var library = [
      { title: 'The Road Ahead', author: 'Bill Gates', libraryID: 1254 },
      { title: 'Walter Isaacson', author: 'Steve Jobs', libraryID: 4264 },
      {
        title: 'Mockingjay: The Final Book of The Hunger Games',
        author: 'Suzanne Collins',
        libraryID: 3245,
      },
    ];
    
    library.sort((a, b) => (a.libraryID > b.libraryID ? -1 : 1));
    for (let item in library) {
      console.log(
        library[item].title +
          ' ' +
          library[item].author +
          ' ' +
          library[item].libraryID
      );
    }
  4. Array Assignment (THA-6)πŸ“„


    Question-1

    Write a JavaScript function to check whether an input is an array or not Test Data : console.log(is_array('w3resource')); console.log(is_array([1, 2, 4, 0])); false True

    function is_array(param) {
      const boolean = Array.isArray(param);
      return boolean;
    }
    console.log(is_array('w3resource'));
    console.log(is_array([1, 2, 3, 4]))``;

    Question-2

    Write a JavaScript function to clone an array Test Data : console.log(array_Clone([1, 2, 4, 0])); console.log(array_Clone([1, 2, [4, 0]])); [1, 2, 4, 0] [1, 2, [4, 0]]

    function array_Clone(array) {
      return [...array];
    }
    console.log(array_Clone([1, 2, 4, 0]));
    console.log(array_Clone([1, 2, [4, 0]]));

    Question-3

    Write a JavaScript function to get the first element of an array. Passing a parameter 'n' will return the first 'n' elements of the array. Test Data : console.log(first([7, 9, 0, -2])); console.log(first([],3)); console.log(first([7, 9, 0, -2],3)); console.log(first([7, 9, 0, -2],6)); console.log(first([7, 9, 0, -2],-3)); Expected Output : 7 [] [7, 9, 0] > [7, 9, 0, -2] []

    function first(array, n) {
      if (n < 0) {
        return [];
      }
      if (n && n >= 0) {
        return array.slice(0, n);
      }
      return array[0];
    }
    console.log(first([7, 9, 0, -2]));
    console.log(first([], 3));
    console.log(first([7, 9, 0, -2], 3));
    console.log(first([7, 9, 0, -2], 6));
    console.log(first([7, 9, 0, -2], -3));

    Question-4

    Write a simple JavaScript program to join all elements of the following array into a string. Sample array : myColor = ["Red", "Green", "White", "Black"]; Expected Output : "Red,Green,White,Black" "Red,Green,White,Black" "Red+Green+White+Black"

    function join_Elements(array) {
      return array.join('+');
    }
    const Colors = ['Red', 'Green', 'White', 'Black'];
    console.log(join_Elements(myColors));

    Question-5

    Write a JavaScript program to find the most frequent item of an array Sample array : var arr1=[3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3]; Sample Output : a ( 5 times )

    function MostFrequent(array) {
      const length = array.length;
      const myobject = {};
      let maxValue = 0;
      let maxIndex;
      for (let i = 0; i < length; i++) {
        if (myobject[array[i]]) {
          myobject[array[i]] = myobject[array[i]] + 1;
          if (maxValue < myobject[array[i]]) {
            maxValue = myobject[array[i]];
            maxIndex = i;
          }
        } else {
          myobject[array[i]] = 1;
        }
      }
      console.log(myobject);
      console.log(maxValue, array[maxIndex]);
    }
    var arr1 = [3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3];
    console.log(MostFrequent(arr1));





About

Repository of DEVSNEST πŸ’¬ Front End Daily Assignments. πŸŒ€

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published