What does this code mean? What do you mean by [] and after []?

 this.$route.query.keyword.split(",")[this.$route.query.keyword.split(",").length - 1]
Apr.01,2021

for example, there is a url link: xxxx.com/path?keyword=a,b,c,d,e
this code takes keyword corresponding value a code divides the last item of the array by comma, that is, e


add a variable to make it clearer

const args = this.$route.query.keyword.split(','); // keyword
args[args.length-1]; // 

get the last value of the comma in the keyword parameter of the current link

  

take the last value in the array converted by keyword

Menu