اذهب إلى المحتوى
  • 0

عندي مشكله في برنامج البث live server لا يقوم بفتح ملف جافا سكربت اذا كان داخل ملف html يفنح ملف html بدون ملف استدعاء لجافا سكربت

Asd البريكي

السؤال

image.png.78a8610d41122ac0ff6326458c671b2d.png 

 خذا خوخ كود جافا سكربت   

   

class Person{

    constructor(name, age){

        this.name =name;

        this.age =age;

 

    }

    get age (){

        return this._age;

 

    }

    hellow(){

        console.log(

            `Hello , My name is ${this.name} ,  and I am ${this.age} years old`

 

        )

    }

       

        }

   

     class Student extends Person {

            constructor(name,age,level){

                super(name ,age);

                this.level =level;

 

            }

}

 

 const Person = new Person('Ibrahim',26);

 Student.hellow();

 

// try and catch

 try{

  alert('try');

 }catch (error){

alert('catch');

 }

  function area(width,height){

    if(isNaN(width) || isNaN(height)){

        throw Error('Parameter is a number');

    }

    return width *height;

  }

   const wait =time => new Promise(

    (resolve,reject) =>{

      if(time > 5000) reject('Sory I can \ t wait');

     setTimeout(resolve ,time)

    }

   );

   wait(2000)

   .then(() => {console.log("hello");

   return wait(1000);

  })

  .then(() => {

    console.log('world !');

  });

  new Promise((resolve,reject) =>{

    setTimeout(() => resolve(1), 1000);

  })

  .then(result => {

    console.log(result);

    return result *2;

   

  });    

حتى لو قمت بادخال اوامر بسيطه

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

من المفترض ان ال live server يقوم بعمل مجلد المشروع الذى تقف فيه الى سيرفر ومن المفترض ايضا ان يستدعى ملفات الجافاسكريبت بشكل طبيعى .

ان الكود الذى قمت بارفاقه يوجد فيه بعض الاخطاء لهذا لا عمل جيدا . وقد قمت بتعديل الاخطاء لك . اذا لم يعمل هل يمكنك ارسال صورة لل console لديك . حتى ارى ما هى الاخطاء الموجودة .

class Person {

    constructor(name, age) {

        this.name = name;

        this.age = age;



    }

    // get age() {

    //     return this._age;
    // }

    hellow() {

        console.log(

            `Hello , My name is ${this.name} ,  and I am ${this.age} years old`



        )

    }



}



class Student extends Person {

    constructor(name, age, level) {

        super(name, age);

        this.level = level;



    }

}



const person = new Person('Ibrahim', 26);

person.hellow();



// try and catch

try {

    alert('try');

} catch (error) {

    alert('catch');

}

function area(width, height) {

    if (isNaN(width) || isNaN(height)) {

        throw Error('Parameter is a number');

    }

    return width * height;

}

const wait = time => new Promise(

    (resolve, reject) => {

        if (time > 5000) reject('Sory I can \ t wait');

        setTimeout(resolve, time)

    }

);

wait(2000)

    .then(() => {
        console.log("hello");

        return wait(1000);

    })

    .then(() => {

        console.log('world !');

    });

new Promise((resolve, reject) => {

    setTimeout(() => resolve(1), 1000);

})

    .then(result => {

        console.log(result);

        return result * 2;



    });

 

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...