-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshopping-2.js
More file actions
24 lines (22 loc) · 935 Bytes
/
shopping-2.js
File metadata and controls
24 lines (22 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/// camera higest price check
const phones=[
{name: 'samsung', camera: 20, storage: '32 gb', price: 36000, color: 'silver'},
{name: 'walton', camera: 12, storage: '32 gb', price: 46000, color: 'silver'},
{name: 'iphone', camera: 99, storage: '32 gb', price: 86000, color: 'silver'},
{name: 'xami', camera: 110, storage: '32 gb', price: 50000, color: 'silver'},
{name: 'nokia', camera: 102, storage: '32 gb', price: 6000, color: 'silver'},
{name: 'oppo', camera: 150, storage: '32 gb', price: 48000, color: 'silver'},
{name: 'symphony', camera: 12, storage: '32 gb', price: 5000, color: 'silver'},
];
function cheapestPhone(phones){
let highest=phones[0];
for ( let i= 0; i < phones.length; i++){
const phone = phones[i];
if(phone.camera > highest.camera){
highest=phone;
}
}
return highest;
}
const mySelect=cheapestPhone(phones);
console.log(mySelect);