hasOwnProperty搜索__proto__?
execute(B)
以上示例来自面向Web开发人员的专业JavaScript
使用chrome:
this
答案 0 :(得分:1)
是的,应该是真的。
library(shiny)
ui <- fluidPage(
actionButton(inputId = "action",
label = "action"),
textOutput("txt_example1"),
textOutput("txt_example2"),
textOutput("txt_example3")
)
server <- function(input, output) {
# ------------------ Example 1 ------------------
# Use a list of reactive values
rv <- reactiveValues(x=0)
# Will update text output when rv$x is updated
observe({
output$txt_example1 <- renderText({ rv$x })
})
# ------------------ Example 2 ------------------
# Make variable a reactive
x <- 0
makeReactiveBinding('x')
# The only 'trick' here is that x is made a reactive so that the observer is
# triggered every time x is updated.
# If x is not made a reactive the value of x will still be updated but the observer
# wont trigger (see example 3).
observe({
output$txt_example2 <- renderText({ x })
})
# ------------------ Example 3 ------------------
# Use ordinary R scoping
x2 <- 0
printUpdate <- function(){
output$txt_example3 <- renderText({ x2 })
}
printUpdate() # Print first value
# onClick listener, same for all examples
observeEvent(input$action, {
rv$x <- rv$x + 1 # Example 1, update reactive list
x <<- x + 1 # Example 2, Save x to parent enviroment
# Example 3
x2 <<- x2 + 1 # Again, save x2 to parent enviroment, see help('<<-')
printUpdate() # Update textOutput
})
}
shinyApp(ui = ui, server = server)
为person1.name = "Greg";
提供了自己的名称属性,因此它不会通过原型链来实现。