___ ___ erkimt JavaScript method ___ ______ ___ azszpr294989

You need to set %code% as an object. So you can build %code% % %code% method as a% function:

%pre%
    
______ ___ azszpr294988

If I create a variable %code% %% %code% is not a function? how I define this method with the function did, in %code% ? if a code as an example, would be very helpful ..

%pre%
    
___

1
___ ___ erkimt JavaScript method ___ ______ ___ azszpr294989

You need to set %code% as an object. So you can build %code% % %code% method as a% function:

function fiz(){
    alert('Eu fiz, o que não fiz!');
}
eu.pensamento = fiz;
eu.pensamento();
    
______ ___ azszpr294988

If I create a variable %code% %% %code% is not a function? how I define this method with the function did, in %code% ? if a code as an example, would be very helpful ..

function fiz(){
    alert('Eu fiz, o que não fiz!');
}
eu.pensamento = fiz;
eu.pensamento();
    
___
asked by anonymous 29.04.2018 / 22:16

2 answers

1
___ ___ erkimt JavaScript method ___ ______ ___ azszpr294989

You need to set eu as an object. So you can build eu.pensamento() % fiz() method as a% function:

function fiz(){
   alert('Eu fiz, o que não fiz!');
}

var eu = new Object();
eu.pensamento = fiz;
eu.pensamento();

console.log(eu.pensamento);
    
______ ___ azszpr294988

If I create a variable %code% %% %code% is not a function? how I define this method with the function did, in %code% ? if a code as an example, would be very helpful ..

function fiz(){
   alert('Eu fiz, o que não fiz!');
}

var eu = new Object();
eu.pensamento = fiz;
eu.pensamento();

console.log(eu.pensamento);
    
___
29.04.2018 / 22:28
0
___ ___ erkimt JavaScript method ___ ______ ___ azszpr294989

You need to set eu as an object. So you can build eu.pensamento % eu.pensamento() method as a% function:

eu = 'Eu...'
function fiz(){
    alert('Eu fiz, o que não fiz!');
}
eu.pensamento = fiz;
eu.pensamento();
    
______ ___ azszpr294988

If I create a variable %code% %% %code% is not a function? how I define this method with the function did, in %code% ? if a code as an example, would be very helpful ..

eu = 'Eu...'
function fiz(){
    alert('Eu fiz, o que não fiz!');
}
eu.pensamento = fiz;
eu.pensamento();
    
___
29.04.2018 / 22:23