drupal 8 get page node
snippet in javascript

drupal 8 get page node

user1324

// Get page node.
$node = \Drupal::routeMatch()->getParameter('node');

// Get page entity.
$params = \Drupal::routeMatch()->getParameters()->all();
$entity = reset($params);