jQuery

Translate a JS string from Drupal interface translations

Translate a JS string from Drupal interface translations

Drupal.t()

Drupal.t("My String");

Clear the Drupal Cache.

This string appear in /admin/config/regional/translate

if not then check your libraries.yml file 
And add the corresponding dependencies THEME.libraries.yml:
dependencies:
  - core/jquery
  - core/drupal

Enjoy :)

Drupal jQuery Behaviors

(function($) {
  Drupal.behaviors.mymodulename = {
   attach: function (context, settings) {
     // Code here
   }
  };
} (jQuery));

Store our function as a property of Drupal.behaviors

context: Initially the context will contain the entire document and after AJAX call will have newly added elements.

settings: The use of settings is to pass values from PHP to Javascript.

IOS/Android - check the user agent to see if the browser is IOS or Android?

function isAppleDevice(){
    return (
      (navigator.userAgent.toLowerCase().indexOf("ipad") > -1) ||
      (navigator.userAgent.toLowerCase().indexOf("iphone") > -1) ||
      (navigator.userAgent.toLowerCase().indexOf("ipod") > -1)
   );
  }

$(document).ready(function() {