Setting a property descriptor like this:
Object.defineProperty(window, 'someFunction', {
value: function() { alert('safe'); },
writable: false,
enumerable: false,
configurable: false
});
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Setting a property descriptor like this:
Object.defineProperty(window, 'someFunction', {
value: function() { alert('safe'); },
writable: false,
enumerable: false,
configurable: false
});
Is it possible in PHP to require an arbitrary file without leaking any variables from the current scope into the required file's variable namespace or polluting the global variable scope?
We have a lot of setup JS code that defines panels, buttons, etc that will be used in many other JS files.
Typically, we do something like:
grid.js
var myGrid = .....
combos.js
var myCombo = .....
Then, in our application code, we:
application.js
function blah() {
myGrid.someMethod()
}
someother.js
function foo() {
myCombo.someMethod();
myGrid.someMethod();
}
So, should we be using the var myGrid or is better to use window.myGrid
What's the difference?
$GLOBALS["items"] = array('one', 'two', 'three', 'four', 'five' ,'six', 'seven');
$alter = &$GLOBALS["items"]; // Comment this line
foreach($GLOBALS["items"] as $item) {
echo get_item_id();
}
function get_item_id(){
var_dump(key($GLOBALS["items"]));
}
i have this situation:
<a href="#" onClick="submitNotification(1);">click1</a>
<a href="#" onClick="submitNotification(2);">click2</a>
<a href="#" onClick="submitNotification(3);">click3</a>
function submitNotification(cdata){
navigator.notification.confirm(
'do you like '+cdata+' option ',
submit,
'notice',
'Yes,No'
);
function submit(button){
if (button == 1){
alert(id); //or alert(cdata);
} else if (button == 2){
...
}
}
i have this situation:
<a href="#" onClick="submitNotification(1);">click1</a>
<a href="#" onClick="submitNotification(2);">click2</a>
<a href="#" onClick="submitNotification(3);">click3</a>
function submitNotification(cdata){
navigator.notification.confirm(
'do you like '+cdata+' option ',
submit,
'notice',
'Yes,No'
);
function submit(button){
if (button == 1){
alert(id); //or alert(cdata);
} else if (button == 2){
...
}
}