Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vol(input) {
- let number = input.map(Number); //object
- for (i = 0; i < input.length; i += 3) {
- let x = input[i];
- let y = input[i + 1];
- let z = input[i + 2];
- if (inVolume(x, y, z)) {
- console.log('inside');
- }
- else {
- console.log('outside');
- }
- function inVolume(x, y, z) {
- let x1 = 10, x2 = 50;
- let y1 = 10, y2 = 50;
- let z1 = 10, z2 = 50;
- if (x >= x1 && x <= x2) {
- if (y >= y1 && y <= y2) {
- if (z >= z1 && z <= z2) {
- return true;
- }
- }
- }
- return false;
- }
- }
- }
- // vol([8,20,22]);
- // vol([13.1, 50, 31.5, 50, 80, 50, -5, 18, 43]);
- vol([ 50, 80, 50]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement