Advertisement
vladovip

Radio Crystals_JS Fundamentals_MoreEx - To Do?

Feb 5th, 2022
1,280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function radioCrystals (arrayNums) {
  2.    
  3.  let desiredThickness = arrayNums[0];
  4.  let  startingThickness = 0;
  5.  // console.log(desiredThinkness);
  6. for (let index = 1; index < arrayNums.length; index++) {
  7.     startingThickness = arrayNums[index];
  8. }
  9.  
  10. let currentThickness = startingThickness;
  11.  
  12. //Cut – cuts the crystal in 4
  13. function cutOperation (currentThickness){
  14.     return currentThickness = currentThickness/4;
  15. }
  16.  let cutResult = cutOperation (currentThickness);
  17.  
  18. // Lap – removes 20% of the crystal’s thickness
  19. function lapOperation (currentThickness){
  20.     return currentThickness = (currentThickness- 0.20*currentThickness)
  21. }
  22. let lapResult= lapOperation (currentThickness);
  23.  
  24. // Grind – removes 20 microns of thickness
  25. function grindOperation (currentThickness){
  26.     return currentThickness = currentThickness-20;
  27. }
  28. let grindResult = grindOperation (currentThickness)
  29.  
  30. // Etch – removes 2 microns of thickness
  31. function etchOperation (currentThickness){
  32.     return currentThickness = currentThickness-2;
  33. }
  34. let etchResult = etchOperation (currentThickness);
  35.  
  36. //X-ray – increases the thickness of the crystal by 1 micron; this operation can only be done once!
  37. function xRayOperation (currentThickness){
  38.  return currentThickness = currentThickness+1;
  39. }
  40. let xRayResult = xRayOperation (currentThickness);
  41.  
  42. // Transporting and washing – removes any imperfections smaller than 1 micron (round down the number);
  43. // do this after every batch of operations that remove material
  44.  function transportingAndWashing (currentThickness){
  45.      return Math.floor(currentThickness)
  46.  }
  47.  let transpAndWashResult = transportingAndWashing (currentThickness);
  48.  
  49.  while ( currentThickness >= desiredThickness ){
  50.     cutResult(currentThickness);
  51.     transpAndWashResult(currentThickness);
  52.     lapResult(currentThickness);
  53.     transpAndWashResult(currentThickness);
  54.     grindResult(currentThickness);
  55.     transpAndWashResult(currentThickness);
  56.     etchResult(currentThickness);
  57.     transpAndWashResult(currentThickness);
  58.     xRayResult(currentThickness);
  59.  }
  60.  //?? and what is the next???
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. }
  68.  radioCrystals([1375, 50000])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement