This is not quite a function; it looks more like you want a property name.
I'm just going to give you some tips and see which one you like best.
function meow(cat) {
var z = $("#nyan").position()[cat];
alert(z);
}
meow("left");
... or...
function meow(cat) {
var z = $("#nyan")[cat]();
alert(z);
}
meow("height");
... or, indeed, using the function:
function meow(getter) {
var z = getter($("#nyan"));
alert(z);
}
meow(function(nyan) { return nyan.position().left });
meow(function(nyan) { return nyan.position().top });
: , a.b a["b"] - .
, a.x, width true a.y, width false, :
var result = a[width ? "x" : "y"];