Capgemini lead vue js
JS question
1.)output
[
"mumbai": ['abc', 'bbc'],
"bangalore": ['xyz','jkl' ]
]
const input = [
{
name: 'abc',
city: "mumbai"
},
{
name: 'xyz',
city: 'bangalore'
},
{
name: 'bbc',
city: "mumbai"
},
{
name: 'jkl',
city: 'bangalore'
}
]
function sep(data){
let temp = {}
data.forEach((it)=>{
if(temp[it.city]){
temp[it.city].push(it.name)a
}else{
temp[it.city] = [it.name]
}
})
return temp
}
console.log(sep(input))
2.) let a=[1,2,3]
let b= a
b.push(5)
console.log(a,b)
output : [1,2,3,4] [1,2,3,4]
3)
let a=[1,2,3]
let b= [...a]
b.push(5)
console.log(a,b)
output : [1,2,3] [1,2,3,4]
4) let a= b=5
console.log(typeof a)
console.log(typeof b)
number
vue:
1) vuex
2)conditional derivatives
3) can i used v-if and v-for for same div
ans) no
4) can i use v-show and v-for for same div
ans) yes
5) ref vs reactive
Html :
1)center a child div
<div class="parent">
<div class="child">Centered</div>
</div>
<style>
.parent {
display: flex;
justify-content: center; /* Center horizontally */
align-items: center; /* Center vertically */
height: 100vh; /* Full viewport height */
border: 2px solid black;
}
.child {
padding: 20px;
background-color: lightblue;
}
</style>
vuetify or quaser?
ts?
Comments
Post a Comment