var matte_canvas_width = $("#matte_canvas").width();
var matte_canvas_height = $("#matte_canvas").height();
function moulding_draw(img, fillet)
{
//var matte_canvas_width = $("#matte_canvas").width();
//var matte_canvas_height = $("#matte_canvas").height();
console.log("matte_canvas_width: " + matte_canvas_width);
console.log("matte_canvas_height: " + matte_canvas_height);
}
함수 외부에서 변수를 선언하면 콘솔에서 null을 값으로 출력합니다. 왜 이런 일이 일어나는 걸까요?왜 전역 변수가 null입니까?
될 것 폭();.이 기능을 실행할 때''순간에, 널 $ ("# matte_canvas") width();'가 null이 아닙니다 – Peter
외부 범위가 무엇인지는 명확하지 않습니다. – Piskvor