了解JS中的变量分配

时间:2019-06-17 19:57:48

标签: javascript highcharts

在高图表示例中,我无法理解这一行代码

select id, name from target where updated_at = "val1", "val2","val3"

来自此页面 http://jsfiddle.net/d_paul/supgh9c1/4/

任何人都可以提供它的简要说明吗?

1 个答案:

答案 0 :(得分:3)

这是三元运算符,或者更简单地是一行override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View = inflater.inflate(R.layout.fragment_home, container, false) override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) lrMath.setOnClickListener { val matematikaIntent = Intent(requireActivity(), MathActivity::class.java) requireActivity().startActivity(matematikaIntent) } fetchUser() } . . . private fun fetchUser() { val uid = FirebaseAuth.getInstance().currentUser?.uid val ref = FirebaseDatabase.getInstance().getReference("/users") ref.addListenerForSingleValueEvent(object : ValueEventListener { @SuppressLint("SetTextI18n") override fun onDataChange(p0: DataSnapshot) { p0.children.forEach { val user = it.getValue(User::class.java) if (user != null && uid == user.uid) { textGreetings = "Hi " + user.name + "," Picasso.get().load(user.profileImageUrl).into(profile_button) greetings_textview.text = textGreetings flag = 1 } } } override fun onCancelled(p0: DatabaseError) { } } ) } 。一样是

if-else