运行此代码时出现错误,是说typeerror无法将属性读取为未定义的“小写字母”。 代码:-
const notes = [{},{
title: "My next Trip",
body: "I would like to go to USA"
},{
title: "Habbits to work on",
body: "Exercise"
} ,{
title: "Office Modification",
body: "Get a new seat"
} ]
const findNote = function(notes, noteTitle) {
const index = notes.findIndex(function (note , index) {
return note.title.toLowercase() === noteTitle.toLowerCase()
})
return notes[index]
}
const note = findNote(notes, "Office Modification")
console.log(note);
答案 0 :(得分:1)
代码中有2个错误
library(ggplot2)
library(scales)
library(rlang) # for sym
myfunction <- function(var1,var2){
p <- ggplot(diamonds, aes(x=cut, y= !! sym(var1)) ) +
geom_boxplot() +
scale_y_continuous(labels = get(var2))
p
return(p)
}
myfunction('price','dollar')
toLowerCase
属性的空对象-您需要在代码中为此添加安全检查您可以尝试关注
title