Javascript 我能';在我更改或删除括号之间的名称之前,不要总是调用函数
关于此代码,我有3个问题: 任务是在照片周围画一个黑色边框,但有两个功能的帮助 1。括号内的函数名可以包含括号外函数名的一部分。 单词(set),例如: 函数setblakcolor(setBcol) 因为如果我像前面提到的那样写入[(set)],它会报告一个错误 但是当我这样写的时候:黑色(as)它会起作用的。 而不是:函数setBlackColor(setBcol)。//此处为erorr 2.当我使用此函数“border(setboorder);”调用for循环时,程序会报告一个错误,直到我删除括号之间的单词,它才会起作用。 但是如果我把这个词换成另一个词,它就不起作用了 q:这里有什么问题**** 3.函数名称中括号之间的名称赋值是什么,例如:(bC) 功能黑色(bC) 您如何在我的代码中使用这个(bC),为什么Javascript 我能';在我更改或删除括号之间的名称之前,不要总是调用函数,javascript,function,Javascript,Function,关于此代码,我有3个问题: 任务是在照片周围画一个黑色边框,但有两个功能的帮助 1。括号内的函数名可以包含括号外函数名的一部分。 单词(set),例如: 函数setblakcolor(setBcol) 因为如果我像前面提到的那样写入[(set)],它会报告一个错误 但是当我这样写的时候:黑色(as)它会起作用的。 而不是:函数setBlackColor(setBcol)。//此处为erorr 2.当我使用此函数“border(setboorder);”调用for循环时,程序会报告一个错误,直到我
// write your code here
[editor mit der Quelle der Fotos ][1]
//
photo
var img= new SimpleImage("smallpanda.png");
img.setSize(200,200);
print(img);
// function to make black color
function black(as){
pixel.setRed(20);
pixel.setGreen(20);
pixel.setBlue(0);
}
// function to define the black border of the photo and then the function (black) must be called to
// color the border with black
function border(){
// the first line of border above
if((x<w/1) && (y<h/20)){
black(as);
}
//the second left line of the border
if((x<w/20) && (y<h/1)){
// the function with the name
black(as);
}
//right border
if((x>=w/1.06) && (y>=h/100)){
// the function with the name
black(as);
}
// Below border
if((x>w/23)&&(y>h/1.05)){
// the function with the name
black(as);
}
}
for(var pixel of img.values()){
var x=pixel.getX();
var y=pixel.getY();
var w=img.getWidth();
var h=img.getHeight();
border();
}
print(img);
[1]: http://%20https://www.dukelearntoprogram.com//course1/example/index.php
//在这里编写代码
[编辑mit der Quelle der Fotos][1]
//
照片
var img=新的SimpleImage(“smallpanda.png”);
img.setSize(200200);
打印(img);
//功能使黑色
功能黑色(as){
像素。设置为红色(20);
像素设置为绿色(20);
像素设置值(0);
}
//函数定义照片的黑色边框,然后必须调用函数(黑色)以
//把边框涂成黑色
函数边界(){
//上面的第一条边界线
如果((xh/1.05)){
//具有名称的函数
黑色(as);
}
}
for(img.values()的变量像素){
var x=pixel.getX();
var y=pixel.getY();
var w=img.getWidth();
var h=img.getHeight();
边界();
}
打印(img);
[1] :http://%20https://www.dukelearntoprogram.com//course1/example/index.php