JS lit

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.7 kB
3
Indexable
// Objects

// obj = {
//     name: "Vamsi",
//     age: 19,
//     skills: ["JavaScript","Python","TailwindCSS","ReactJS","NextJs"],
//     basedIN: "India",
//     hello: function log (){
//         console.log("Hey there!");
//     }
// }

// console.log(obj.skills);

// constructor functions

function student (name,age){
    this.name = name;
    this.age = age ;
    this.skills = ["JavaScript","Python","TailwindCSS","ReactJS","NextJs"];
}


// console.log(student);

// let s1 = new student ('rohan',20);
// let s2 = new student ('Ajay',20);

// console.log(s1,s2)

// function ss (name,age) {
//    let student = name;
//    let id = age;

//    return { getter: student, id}
    
// }

// let result = ss('vamsi',19);
// console.log(result);


//IIFE - Immediately invoked functions 

// var abc = (function (){
   
//     var a = 12;

//     return {
//         getter: function (){
         
//          console.log(a) // gets the private value
//         },

//         setter: function(val){
//             a = val; // changes the value

//         }
        


//     }
    

// })();

// console.log(abc.getter())


//Prototype Inheritence

// let human = {
//     canTalk: true,
//     canWalk: true,
//     canFly : true,
// }


// let coder = {
//     canCode : true,
//     canBuildWebsites : true,
// }

// coder.__proto__ = human;



// Asynchoronus JS


async function github(){

  let res =  await fetch(`https://api.github.com/users/vamsieth`);

  let data = await res.json();

  console.log(data.login,data.followers)
}

let ans = github();
console.log(ans);